c++

Keep windows trying to read a file

I'm working in a sort of encapsulation of the windows filesystem. When the user request to open a file, windows calls to my driver to provide the data. In normal operation the driver return the file contents which is cached, However, in some cases the real file is not cached and I need to download it from the network. The question is i...

changing rgb values

hi i am trying to change a part of an image with another image i couldn't find the merging function so i just occur that can i change the rgb values of the part i want to change with the other images rgb values is it possible thanks for suggestions ...

How can I get the IP address of a network printer given the port name using the Win32 API?

How can I get the IP address of a network printer given the port name, using win32 API? I tried looking into the PRINTER_INFO_* structs, but it seems it is not present there. ...

Debugging with Eclipse CDT and GDB

Hy, I have Eclipse CDT C++ application project that uses shared library. This library is compiled with debug info and its' source is available at the right path. Now I try to debug my application with Eclipse and GDB. If I put breakpoints in my application source code, everything is fine. Then I open a source file of the included shar...

C++ Array size x86 and for x64

Simple question, I'm writting a program that needs to open huge image files (8kx8k) but I'm a little bit confused on how to initialize the huge arrays to hold the images in c++. I been trying something like this: long long SIZE = 8092*8092; ///8096*8096 double* array; array = (double*) malloc(sizeof(double) * SIZE); if (array == NU...

OpenCV on Embedded Platform

Can some suggest a test/development embedded platform to use with OpenCV. I would like to develop an embedded video analytics solution, but I don't know where to start. Some suggestion/ideas/hw starter kits? Maybe some Pc-104 solutions with Intel Atom? Has someone made some test about performances on this platform or any other embedded ...

compressing a file

how can i compress a file in c/c++.i want to devlop application like winzip/winrar. A simpler one ...

Is '@' used in C++?

Is '@' used in C++? In this yacc file it is listed as a token. And i am sure i cant use @ as part of a variable name. Is @ used in C++? and how might i use it? ...

c++" fatal error C1083: Cannot open include file: 'blabla': No such file or directory" only in Release Build

Hello, whenever I compile my project in the Release build I get this error: Error 29 fatal error C1083: Cannot open include file: 'NX_Win32Wrapper.h': No such file or directory I get another one just like this, just in a different file (the error complains about a different file). The file in the second error is whichever I included...

How to debug 'value of ESP was not saved across function call' error?

On rare occasions when my program exits, I get a "value of ESP has not been saved across a function call" error. The error is quite random and hard to reproduce. How do I debug this error (VC++ 2008)? How harsh it is, as it only occurs on shutdown? Is the error visible also in release mode? ...

Forcing an error when a function doesn't explicitly return a value on the deafult return path?

Is there a way, in VC++ (VSTS 2008), to froce a compiler error for functions that do not explicitly return a value on the default return path (Or any other quick way to locate them)? On the same issue, is there any gaurentee as to what such functions actually return? ...

What todo to force XP shim in Vista

In Vista, we can create a shimming .sdb file to force e.g. XP compatibility. You can also do some stuff in a manifest file you embed in your executable. Are there any command line options or environment variables that can be set to force these settings. I found some references to WinAmp to do this, but is there an overview of all possib...

Wrapping C++ class API for C consumption

Hi there, I have a set of related C++ classes which must be wrapped and exported from a DLL in such a way that it can be easily consumed by C / FFI libraries. I'm looking for some "best practices" for doing this. For example, how to create and free objects, how to handle base classes, alternative solutions, etc... Some basic guidelines...

Gtkmm - "Gtk::DrawingArea" in "Gtk::ScrolledWindow"?

Hello, I am making a GUI program using "gtkmm". I would like to draw some graphics to the "Gtk::DrawingArea" widget but I want that widget to be "resizable", so when I draw let's say a line from "(0, 0)" to "(50, 50)" pixel - the drawing area should be resized to a square of size "(50, 50)"; and when I for example draw a line from "(0...

How to detect and estimate heap fragmentation in my C++ program?

I'm developing a VC++ NT service that is meant to operate continuously for many months. It uses VC++ runtime heap intensively. Clearly heap fragmentation can at some point cause it malfunctioning (thinking it's out of memory). What tests can I run on my service to estimate the degree it is prone to heap fragmentation? ...

How to check if the first char in the line is # (beginning of a comment)

I have been following this convention thus far: std::string line; while(std::getline(in,line)) { if(line.size() && line[0] =='#') continue; /* parse text*/ } The obvious drawback is that comment may not begin at the first character, in the case of leading whitespace. What is the good way to deal with this sort of a thi...

How to determine where code spends a lot of time in a kernel space (system calls)

I noticed that 10% my code run is system space. However I do NOT know which system calls. I suspect, though, it is either has to do files or timestamps. Is there a tool to figure out which system calls are the culprits? Also, I want to know the frequency of (and location) of calls (and callee) . I am on AS3 thx ...

Do pointers to string literals remain valid after a function returns?

Is the pointer returned by the following function valid? const char * bool2str( bool flg ) { return flg ? "Yes" : "No"; } It works well in Visual C++ and g++. What does C++ standard say about this? ...

How to make functions with flag parameters? (C++)

How could I make a function with flags like how Windows' CreateWindow(...style | style,...), for example, a createnum function: int CreateNum(flag flags) //??? { int num = 0; if(flags == GREATER_THAN_TEN) num = 11; if(flags == EVEN && ((num % 2) == 1) num++; else if(flags == ODD && ((num % 2) == 0) ...

CComBSTR memory allocation

I have a "const char* str" with a very long string. I need to pass it from a cpp client to a .Net COM method which expects BSTR type. Currently I use: CComBSTR bstr = str; This has the following issues: Sometimes this line fails with out of memory message When I pass the bstr to the COM class it takes a lot of memory (much more than...