c++

What should I do next?

I have been learning c++ but my problem is i don't know what to do next. I know how to use pointers, classes etc... in C++ but i haven't written a real program, only assigments from the university(calculating arithmetic means, mean deviation etc)... What should i do? Thank you ...

what's the mechanism of sizeof() in C/C++?

It seems sizeof is not a real function? for example, if you write like this: int i=0; printf("%d\n", sizeof(++i)); printf("%d\n", i); You may get output like: 4 0 And when you dig into the assemble code, you'll find sth like this: movl $4, %esi leaq LC0(%rip), %rdi xorl %eax, %eax call _printf So, the compiler put d...

Operations and functions that increase Virtual Bytes

Having some out-of-memory problems with a 32-bit process in Windows I begun using Performance Monitor to log certain counters for that process. Though it is normal that Virtual Bytes is higher than both Private Bytes and Working Set, I found that in my case there was a substantial difference, Virtual Bytes was much higher than both Priv...

Test driven development for C++ XPCOM component ?

I want to create a Firefox extension using c++ XPCOM component which in turn uses javascript XPCOM component. Is there any framework that allows test driven development of C++ XPCOM component/firefox extension ? ...

Is there an error in POCO C++ library documentation?

Here is the confusing page. Search for "/bin/ps". The line is: ProcessHandle ph(launch("/bin/ps", args, &outPipe, 0, 0)); Shouldnt it be: ProcessHandle ph(launch("/bin/ps", args, 0, &outPipe, 0)); ? ...

Trouble with const

I should get this by now, but I'm just not getting it yet. The trouble is operator='s argument could be non-const, but that breaks std::vector::push_back because it makes the item const, so operator= has to accept a const object. Well, I'm not certain on how I'm supposed to modify the this object working like this. #include <vector> #in...

How can I convert from DWORD RGBA to ints?

Hello there, I have to convert a DWORD (unsigned long) RGBA to four int vars (R, G, B, and A) So far, I have this function to convert the 4 ints to a DWORD: unsigned long RGBA2DWORD(int iR, int iG, int iB, int iA) { return ((iA << 24) | (iR << 16) | (iG << 8) | iB); } How can I convert it back? Something like struct RGBA { int R,...

QtCreator delete file is not working

Hi, I'm writing a "custom makefile" project using QtCreator and I want to delete a file of my project, so, I select the file in the tree view, press the right click and the "delete" option is disabled and I did not find any way of enable it. My environment: QtCreator 1.2.1 on SnowLeopard: Thanks in advance, Ernesto ...

What exactly happens when my process is killed?

I have a mixed process with native and managed code, running on Windows server 2003. When I kill my process from within process explorer it goes into a state of 100% cpu and stays like that for a while (sometimes even 10 minutes) before going away. During this time I cannot "kill" it or do anything else. What exaclty happens to a proce...

Need help with three visual studio errors - C++ errors occuring when trying to build solution

I get the following errors when I try to build this project: error C2182: 'read_data':illegal use of type 'void' error C2078: too many initializers errors c2440: 'initializing': cannot convert from 'std::ofstream' to int All of the above seem to be pointing to my function call on line 72, which is this line: void read_data(finput, fo...

What is the simplest way to execute arbitrary process with stdin, stdout forwarded to a socket?

I'm interested in two situations: How to do it from C++? How to do it from system's shell? Answers for Linux, Windows and OSX are welcome. ...

Network programming: SOAP vs DIY marshalling with XML library?

I know that there are a lot of discussions already on SO about SOAP, bloat, XML, and alternative mechanisms like REST. Here's the situation. A new team member is really talking up SOAP based upon the difficulty of implementing protocols by hand. He recommends gSOAP (project is all in C++.) He is stating things like WSDL cleaning up lots...

How to find free memory within a specific address range.

I want to write a small amount of memory inside of a specific address range of my process. Example amount of memory to allocate: 5 bytes lower bound for address: 0x 00 40 00 00 upper bound for address: 0x 00 A0 00 00 The range in which I want to write is already allocated by the process. Therefore, I can't simply allocate new mem wi...

Compiler warning with nested vectors of depth 3 or more

Hi, I am trying to use a class member that uses nested vectors of depth 3: vector< vector< vector > > classVariable_; However, I then get compiler warnings throughout my code when I try do something as simple as classVariable_.clear(): /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_vector.h: In member function `std::vector<_T...

::CreateFile with the FILE_FLAG_DELETE_ON_CLOSE flag.

Before I describe my problem, here is a description of the program (IHExplorer.exe) I'm writting: This is a C++ application. The IHExplorer application is to look as much like a Windows Explorer window as possible. With one exception, and that is that launching files from within this Explorer window will decrypt them first to the user'...

C++ programmer looking to broaden perspective

I've been programming C++ for about 5 years now, and I now realize the value of knowing how to think "differently." This question is for C++ programmers who tried out other programming languages and came across moments like: "Whaoo..this is sooo cool! I didnt know I can program like that." "Wow, I never thought a design problem could ...

gdb - how to print result of evaluation for C++

Hi, Ive been looking around but was unable to figure out how one could print out in gdb the result of an evaluation. ie for instance in the code below: if (strcmp(current_node->word,min_node->word) > 0) min_node = current_node; (above i was trying out a possible method for checking alphabetical order for strings, and wasnt abso...

C++ system() function - How to collect the return value of the issued command?

Hello, I run some commands with the C++ system() function (int system ( const char * command );). How can I collect the return value of the issued commands? EDIT: To be more specific: I want to collect the output of the issued command. i.e. the directory listing of the dir command. Thanks, mspoerr ...

Webkit on Windows Mobile

I wish to embed webkit in a windows mobile application. The goal is to allow it to run web apps. I've tried the Qt version, but only webkit is required and not the rest of the functionality Qt has. ...

How to read exactly one line?

I have a Linux file descriptor (from socket), and I want to read one line. How to do it in C++? ...