How do I find a particular value in an array and return it's index?
Pseudo Code: int arr[ 5 ] = { 4, 1, 3, 2, 6 }, x; x = find(3).arr ; x would then return 2. ...
Pseudo Code: int arr[ 5 ] = { 4, 1, 3, 2, 6 }, x; x = find(3).arr ; x would then return 2. ...
I'm having problems with std::getline on Mac OSX Snow Leopard. For some reason it limit the size of the input, while on Debian/Ubuntu it's unlimited size? std::getline(std::cin, input) Any clues about the limit? ...
It isn't clear what happens if I delete a virtual method in C++0x: virtual int derive_func() = delete; Does this mean this class and everything that inherits from it can not define/implement the derive_func() method? Or is this illegal/compile error? ...
I'm using the ListView control from Common Controls 6.0 in C++ and I need the ListView to be single-select only. All of the higher level controls have this feature (e.g. .Net and Qt), but I imagine they are based on this control deep down somewhere. Any ideas on how I can get this to behave as a single-select list? Just in case it mak...
I want to write a program using Qt that downloads a lot of HTML web pages, about 5000, from one site every day. After downloading that pages I need to extract some data using DOM Query, using the WebKit module, and then store that data in a database. Which is the best/correct/efficient way to do that, in particular the download and anal...
Hi, I'm using GLFW for creating OpenGL context and capturing user's input and I wanted to capture whole input actions from other thread than OpenGL context was initially created. Am I able to achieve this by using GLFW, SDL or similar library or need I, for example, use different libraray for each task? And if so, which library would yo...
i have a very simple c/c++ program that forks a child process to execute another program, and then sends some data to that child program, and waits for the response. the child program reads from stdin and waits for EOF before it continues. my problem is, the child program receives the initial input from the pipe writing, but it never s...
lets make the simpliest application: result: ok. it works. lets add some SDL with default dynamic linking here! result: works great. at stdout.txt we can see "puchuu" lets change our makefile a little. just group 2 object files to the static lib: result: Who is to blame? Me or mingw developers? is it clear to...
I want to read a txt file line by line and after reading each line, I want to split the line according to the tab "\t" and add each part to an element in a struct. my struct is 1*char and 2*int struct myStruct { char chr; int v1; int v2; } where chr can contain more than one character. A line should be something like: ...
I have written a program that utilizes 2 3rd party dll's and I want to use ILMerge to merge both dll's into 1 executable. I have tried using the command line: ilmerge /target:winexe /out:final.exe normal.exe 3rd_party_dll_1.dll 3rd_party_dll_2.dll but this returns this error: `Could not load assembly from the location 'C:\Users...
Can I call the C++ placement new on constructors with parameters? I am implementing a custom allocator and want to avoid having to move functionality from non-default constructors into an init function. class CFoo { public: int foo; CFoo() { foo = 0; } CFoo(int myFoo) { foo = myFoo; } }; CFo...
Hello everybody here, I'm trying to write my own version of connected components discovery using the breadth-first search algorithm included in the Boost Graph Library and I need to access the ancestor (the vertex which leads to the discovery of the current vertex) vertex from withing the discover_vertex callback of my visitor to se...
How can I go about detecting a space OR another specific character/symbol in one line of a file using the fstream library? For example, the text file would look like this: Dog Rover Cat Whiskers Pig Snort I need the first word to go into one variable, and the second word to go into another separate variable. This should happen for ev...
as the question says, i want to simply send data from the iphone (ipad later) to a computer so max msp can retrieve the data (string) and do whatever over a wifi local network. Its as simple as that. i don't want fancy any interface on the sending/receiving end or any extra options. Thats all i want. Can anyone guide me with this ple...
How to in c++ 2010 builder show hint all the time when is code write? For example if I try to use command MessageBox, I start to type message and press control+space, that will be show up list of functions which have first letter same, and after that I press enter on which function I like and that give me a yellow hint, everything is ok ...
Some C++ libraries call abort() function in the case of error (for example, SDL). No helpful debug information is provided in this case. It is not possible to catch abort call and to write some diagnostics log output. I would like to override this behaviour globally without rewriting/rebuilding these libraries. I would like to throw exce...
In the local object there is a collate facet. The collate facet has a hash method that returns a long. http://www.cplusplus.com/reference/std/locale/collate/hash/ Two questions: Does anybody know what hashing method is used. I need a 32bit value. If my long is longer than 32 bits, does anybody know about techniques for folding the ha...
Hello, I thought that I wanted to template function specialization, but this stackoverflow article makes me think that I should really by doing function overloading. However, I'm just not seeing how I could achieve what I want. I have been able to achieve the goal with a class template specialization, but I don't like the fact that I h...
I have a class which has a std::vector of child control pointer. For obvious reasons, I do not want the user of the class to have direct access to the std::vector. All I would want is a way to give the caller the pointers. What would be a good OO way to do this? (this function will be called often) Thanks ...
By "local" I mean both run in the same subnet, in most cases the same host/VM, therefore some standard cross-network cross-platform RPC mechanisms like SOAP, XML-RPC, CORBA, etc. seem unnecessary. The payload is mainly numerical (mostly tabulated) data with some small amount of meta data (for example available data services, data descri...