c++

C++ 'strcpy' gives a Warning (C4996)

I am getting this his warning but all functions working properly . what does this really means? 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. ...

how to use ShellExecuteEx to run an application on windows ce?

I am using this code: SHELLEXECUTEINFO ShExecInfo = {0}; ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; ShExecInfo.hwnd = NULL; ShExecInfo.lpVerb = NULL; ShExecInfo.lpFile = _T("\\test\\WindowsCE\\test.exe"); ShExecInfo.lpParameters = _T(""); ShExecInfo.lpDirectory = NULL; ShExecInfo.n...

C++ Using a file format

Hi there, A couple of days ago, I asked how you could reverse engineer a file format. While that didn't really work out, someone gave me the file format. (Click Here) Thank you Xadet. I'm still quite new to all this, and I was wondering where I should go from here. I am guessing I will have to use inline-asm in C++ to use this format, ...

Loading an image from resource and converting to bitmap in memory

I've searched around using google but I'm completely confused on how to load an image (PNG in my case) from resource and then converting it to a bitmap in memory for use in my splash screen. I've read about GDI+ and libpng but I don't really know how to do what I want. Could anyone help? ...

run threads in visual c++ 2010

i am using visual c++ 2010 can i run this code? what should i add to visual studio? ...

c++ - what to do if debug runs fine, but release crashes

Hey there! I have an application that runs just fine in the debug build, but when I start it in the release build, i get a unhandled Exception at 0x0043b134 in myapp.exe: 0xC0000005: Access violation while reading at position 0x004bd96c if i click on 'break' it tells me that there are no symboles loaded and the sourcecode can't be di...

C++ overloaded new[] query : What size does it take as parameter ?

I have overloadded operator new[] like this void * human::operator new[] (unsigned long int count){ cout << " calling new for array with size = " << count << endl ; void * temp = malloc(count) ; return temp ; } and now calling human * h = new human[14] ; say sizeof(human) = 16 , but count it prints is 232 wh...

getting 'undeclared identifier' error

Following the tutorial at http://www.codersource.net/mfc/mfc-tutorials/ctabctrl.aspx , I have declared the function ActivateTabDialogs() in my header file and called it inside another function in my class. The compiler gives error C2065: 'ActivateTabDialogs' : undeclared identifier, at the line ActivateTabDialogs(); inside the definition...

UDP checksum error c++

I am calculating UDP checksum using the following function (found it somewhere): uint16_t udp_checksum(const void *buff, size_t len, in_addr_t src_addr, in_addr_t dest_addr) { const uint16_t *buf=(const uint16_t *)buff; uint16_t *ip_src=(uint16_t *)&src_addr, *ip_dst=(uint16_t *)&d...

boost::regex and tilde (~)

Please could you explain why given the following boost::regex pattern: boost::regex re("/\\S+\\w"); /index.html is a match and /~index.html is not? RegexBuddy in Perl mode finds a match in both cases. Could you suggest a pattern that would work? Thanks!! P.S. The \\w at the end is needed in order to ignore the punctuation on the en...

Converting ppm to png

Hello, I am working on a code and we are getting PPM as the image format, this needs to be converted to PNG and then saved. I was looking at some API's to achieve this conversion from PPM to PNG. Can this be done using GDI+, as this would become native? If that is not possible then I think freeimage or pnglib can accomplish that, howeve...

static_cast on derived classes when base turns from not polymorphic to polymorphic

Hi All I am reviewing C++ casts operator and I have the following doubt: for polymorphic classes I I should use polymorphic_cast I should never use of static_cast since down-casting might carry to undefined behavior. The code compiles this case anyway. Now suppose that I have the following situtation class CBase{}; class CDerive...

BadPtr after several iterations

Hello guys, C++. Its may be more question of debugging in Visual Studio and working with memory. I have a program that analyzes list of files, and path to current file is a concatenation of to strings: CString object named 'folder' and filename itself(CString too). But after 144'th iteration(im sure the number is unimportant), folder ...

How to speed up transfer of images from client to server

I am solving a problem of transferring images from a camera in a loop from a client (a robot with camera) to a server (PC). I am trying to come up with ideas how to maximize the transfer speed so I can get the best possible FPS (that is because I want to create a live video stream out of the transferred images). Disregarding the physica...

c++ vector of iterators

I understand that I can point to number of vectors std::vector<int> using for loop on one vector<int*> onev_point_2_all etc.. but how do i do that using iterators is there a way of creating a vector of iterators instead of a vector of pointers ? ...

Adding HTTP header to all outgoing packets on Windows?

I am developing a Windows application that will live in the system tray. The application can be enabled/disabled by the user. Whenever the user enables it, it needs to listen/sniff HTTP traffic and add a specific HTTP header on all outgoing packets. I think it can be done by changing the system or browser settings to be localhost:my_po...

Using strings to identify objects: what's the purpose ?

OGRE3D for example uses strings to identify objects, so each time the code does something on an object using its name (a string), it has to do string operations, and since a 3D engine is very sensitive on speed, how can it be a good way on doing it ? When a computer has to do operations on a string, it does it sequentially, bytes after ...

change of vectors first pointer

hello, when i use vector to store some data, i usually access to this data by the pointer of the vector's first entry. because it it faster than the at() method. but i realize that when i insert a block of data, say an array to the end of vector, the first entry's pointer changes. this may be realated to stack stuff, but if i add the ar...

Error when trying to price instrument when using Quantlib

I am receiving the following error when trying to price a 20x10 swap from a bootstrapped curve. The error get thrown on the last line of the ImpliedRate function SwapRatesServiceTests.ImpliedRate_ForTwenty_x_TenYearSwap_ReturnsRate: System.ApplicationException : 2nd leg: empty Handle cannot be dereferenced I don't have the faint...

Libjpeg error - improper call in state 205

Hi everyone, I'm using libjpeg (C/C++ programming on Windows Mobile 6.5), in order to decode images from an IP camera (sent in a MJPEG stream), before pushing them into a DirectShow graph. Until now, I've been using a single function for : receiving the stream, parsing it manually (in order to find JPEG data starting- and end-point), d...