c++

C++ Serial Communication

I'm running Ubuntu 9.10 and I seem to be having trouble with termios. So I can start minicom open the serial port at 57600 Baud, 8N1, no hardware or software flow control and it works great. I type in @17 5 and my device responds. When I try to set up my serial port in my C++ code I don't get a response. I know that the software is com...

What to do when an out-of-memory error occurs?

Possible Duplicate: What's the graceful way of handling out of memory situations in C/C++? Hi, this seems to be a simple question a first glance. And I don't want to start a huge discussion on what-is-the-best-way-to-do-this.... Context: Windows >= 5, 32 bit, C++, Windows SDK / Win32 API But after asking a similar questio...

Language/GUI library to make map editor

I'm designing a cross-platform map editor for an application I've developed, and I'm unsure what approach to take regarding language/gui library choice. Just for some basic info, the editor needs to parse and output xml files. I'm most comfortable with C++, Lua, and Perl, but I'd also be willing to use Python (could use the practice). I...

How would I find the height of the task bar?

In my windows application, I am trying to find the height of the task bar. While I can hard program this into my program, I would like to find it programmatically to support past, present (win7) and future windows versions. So, how would I do this? ...

Breaking into Debugger when a process accesses a file, or get a call stack of file accesses from a process

I'm dealing with some hundreds of thousands of lines of code, and I'm stumped where this process is accessing a particular file. I've given up searching the code, I just cannot find out. So, here I am -- asking a question I'm almost certain there is no simple solution for. I've tried FileMon, ProcMon from SysInternals, and while I can ...

How to delete IE addressbar history on Vista/Win7?

First, here is a picture of what I see http://img713.imageshack.us/img713/4797/iedrop.png I need an solution to clear addressbar dropdawn, but not using ClearMyTracksByProcess or IE dialogs. I need to delete only a specific URL and all his traces. I deleted manually all traces of that URL in: Users\\AppData\Local\Microsoft\Windows\Te...

Arbitrary pointer to unknown class function - invalid type conversion

I have a hack program; it injects some functions into a target process to control it. The program is written in C++ with inline assembly. class GameProcMain { // this just a class }; GameProcMain* mainproc; // there is no problem I can do =(GameProcMain*)0xC1EA90 Now I want to define a class function (which set ecx to class pointer)...

C++ double value losing precision when multiplied?

I am trying to create a function to find the square root of a number. For debugging purposes, it has instructions to print current variable values. The function squareRoot accepts two arguments, x and t. It then declares and initializes n and s. n is the amount to add or subtract, halving every time it is used. s is what is thought to be...

Under what scenarios would you declare a non-reference, non-pointer type function parameter const?

I have the following function declaration: void fn(int); This function has a single integral type parameter. Now, I could call this function by passing a non const or a const integral object. In either case, this function is going to copy the object to its local int parameter. Therefore, any modifications to this parameter is going to...

How do I get the correct case of a path?

I have a small but itching problem. How do I get the correct case for a Windows path in Qt? Let's say i have a path c:\documents and settings\wolfgang\documents stored in a QString str and i want to know the correct case, here C:\Document and Settings\Wolfgang\Documents. QDir(str).absolutePath() doesn't get me the path with correct case...

wxWidgets AddRoot() on wxTreeCtrl fails to add more then one node

I'm using wxWidgets 2.8.11 on Windows 7 64 Bit. I created a wxTreeCtrl control, which as the name suggests, is a tree control. You can add Root nodes by calling AddRoot(), however it seems to only work the first time of calling it. Here is the code where I create the Tree: newHandler-> sendPacketTree = new wxTreeCtrl(newHandler->sendGr...

What topic is more perspective in terms of market - Cloud computing or Video restoration?

I am choosing topic for a paper to work on during this year at university, I wonder which one is more wanted by market \ job providers here are ones I have some knowledge on: cloud \ farm computing ( meaning task management, process control, creation of environment, messaging between parts of system etc) and 2d video to 3d reconstruc...

A std::vector of pointers?

Here is what I'm trying to do. I have a std::vector with a certain number of elements, it can grow but not shrink. The thing is that its sort of cell based so there may not be anything at that position. Instead of creating an empty object and wasting memory, I thought of instead just NULLing that cell in the std::vector. The issue is tha...

How to write a double type into file in c/c++ in windows?

double Time; ... WriteFile( tmp_pipe, Time, sizeof(double), &dwWritten, NULL ); The above reports : error C2664: 'WriteFile' : cannot convert parameter 2 from 'double' to 'LPCVOID' ...

exception handling in C++

Hi all, i have the following program using exception handling. #include<iostream.h> #include<conio.h> void divide(int x,int y,int z) { cout<<"\n Inside function 1 \n"; if((x-y)!=0) { int R=z/(x-y); cout << "Result =" << R<<"\n"; } // end of if else { throw(x-y); } // end of else } // end of void int main(...

Using Sleep() while using timers through setitimer

I am using a timer in my C++ code through setitimer function from sys/time.h. This maps the SIGALRM signal to my timer handler method. After this I am not able to use sleep function. I am assuming it is because sleep uses SIGALRM signal as well. Can you suggest any workaround for this problem? Thanks for replying. ...

How to erase entries from vector in C++ ?

I'm basically looping through all the entries to check whether some entries is to be erased, but seems in a wrong way: std::vector<HANDLE> myvector; for(unsigned int i = 0; i < myvector.size(); i++) { if(...) myvector.erase(myvector.begin()+i); } Anyone spot the problem in it? How to do it correctly? ...

C++ reading an remote fie using boost.???

Hello, I need to read an remote file using c++,i am trying to read an remote robots.txt file with an example ... eg www.google.co.in/robots.txt ...

Which book provides a good intermediate level introduction to C++?

Possible Duplicate: The Definitive C++ Book Guide and List I am entering my second year at University studying Games Design with a focus on programming. I have beginner knowledge of Java and ActionScript 3, and am working my way through "Java in Two Semesters" by Charatan and Kans. I enjoy the layout and method of teaching i...

How to reset SIGINT to default after pointing it some user-defined handler for some time?

I use signal(SIGINT,my_handler) to point SIGINT to my_handler. After some time I want to reset it to whatever default handler it points to in general. How can I do that? ...