c++

How to control a cursor position in c++ console application?

前提是你 提交于 2021-02-19 09:12:46
问题 I'm supposed to create a console application for school project and it's about Sudoku Game, so the thing is i don't find any struggle with the algorithm, but i was wondering if i could draw the full Sodoku table with c++ and make empty squares as "data" input place so the user can move the cursor using the arrow keys to the specific number's place to fill it with the appropriate number. is there a method to do it this way ? 回答1: It depends on your OS/Compiler. For example, in VC++ you can use

How to control a cursor position in c++ console application?

家住魔仙堡 提交于 2021-02-19 09:11:21
问题 I'm supposed to create a console application for school project and it's about Sudoku Game, so the thing is i don't find any struggle with the algorithm, but i was wondering if i could draw the full Sodoku table with c++ and make empty squares as "data" input place so the user can move the cursor using the arrow keys to the specific number's place to fill it with the appropriate number. is there a method to do it this way ? 回答1: It depends on your OS/Compiler. For example, in VC++ you can use

How to control a cursor position in c++ console application?

▼魔方 西西 提交于 2021-02-19 09:09:00
问题 I'm supposed to create a console application for school project and it's about Sudoku Game, so the thing is i don't find any struggle with the algorithm, but i was wondering if i could draw the full Sodoku table with c++ and make empty squares as "data" input place so the user can move the cursor using the arrow keys to the specific number's place to fill it with the appropriate number. is there a method to do it this way ? 回答1: It depends on your OS/Compiler. For example, in VC++ you can use

How to control a cursor position in c++ console application?

若如初见. 提交于 2021-02-19 09:07:21
问题 I'm supposed to create a console application for school project and it's about Sudoku Game, so the thing is i don't find any struggle with the algorithm, but i was wondering if i could draw the full Sodoku table with c++ and make empty squares as "data" input place so the user can move the cursor using the arrow keys to the specific number's place to fill it with the appropriate number. is there a method to do it this way ? 回答1: It depends on your OS/Compiler. For example, in VC++ you can use

How to use Swig to treat a void * function parameter as Python string

自闭症网瘾萝莉.ら 提交于 2021-02-19 09:05:22
问题 Here is my c++ code: struct Impl { DT* data_ptr_; Impl(void* data_ptr) : data_ptr_((DT*)data_ptr) { //do something to decipher data } }; Impl class takes a void pointer, as a input parameter. What I want to do is just pass a Python string(binary string as in Python 2.x) as parameter: data = "I'm a stirng data!" impl = Impl(data) But Swig generated module raises this TypeError: in method 'new_Impl', argument 1 of type 'void *' I'm new to swig and have searched in SWIG documentation for a whole

How to use Swig to treat a void * function parameter as Python string

戏子无情 提交于 2021-02-19 09:04:57
问题 Here is my c++ code: struct Impl { DT* data_ptr_; Impl(void* data_ptr) : data_ptr_((DT*)data_ptr) { //do something to decipher data } }; Impl class takes a void pointer, as a input parameter. What I want to do is just pass a Python string(binary string as in Python 2.x) as parameter: data = "I'm a stirng data!" impl = Impl(data) But Swig generated module raises this TypeError: in method 'new_Impl', argument 1 of type 'void *' I'm new to swig and have searched in SWIG documentation for a whole

How to use Swig to treat a void * function parameter as Python string

风流意气都作罢 提交于 2021-02-19 09:04:01
问题 Here is my c++ code: struct Impl { DT* data_ptr_; Impl(void* data_ptr) : data_ptr_((DT*)data_ptr) { //do something to decipher data } }; Impl class takes a void pointer, as a input parameter. What I want to do is just pass a Python string(binary string as in Python 2.x) as parameter: data = "I'm a stirng data!" impl = Impl(data) But Swig generated module raises this TypeError: in method 'new_Impl', argument 1 of type 'void *' I'm new to swig and have searched in SWIG documentation for a whole

How to call a C++ DLL from VB6 without going through COM?

﹥>﹥吖頭↗ 提交于 2021-02-19 08:48:28
问题 OK, so I have a C++ project that compiles to a DLL file. I am able to reference this file in C# and see/use all of the objects and functions within the DLL file. What I need to do is to reference those objects and function through VB6. The C++ code has nothing in it that looks like it's creating a DLL. There are no '__declspec(dllexport)' modifiers, just C++ code. There are objects like this: String ^ Array^ I'm not entirely sure what they are. My knowledge of C++ is not very extensive and I

Ring buffer with atomic indexes

半世苍凉 提交于 2021-02-19 08:45:38
问题 I have struggled with what must be a fundamental misunderstanding of how atomics work in C++. I have written the code below to implement a fast ring buffer using atomic variables for indexes so multiple threads can write to and read from the buffer. I've whittled the code down to this simple case (which I realize is still a little long. Sorry.). If I run this on either Linux or Mac OS X, it will work some of the time, but it will also throw exceptions at least 10% of the time. It also seems

How to initialize a constexpr std::array with templated constexpr member functions?

走远了吗. 提交于 2021-02-19 08:45:38
问题 This is a follow up of my question given here. In the end I want to create a constexpr std::array containing text with an appended running index. I wanted to try a different approach than in the previous question. Nearly everything, what I do in the below code is constexpr. But maybe, it is simply the old problem of returning a pointer to a no longer existing variable. But, I doubt this. Please see the following code, where the not working line in function main is marked. #include <iostream>