stack around the variable…was corrupted

Why did you declare you character buffer a size of 20? More than likely the sprintf placed more characters than that can fit in myChar. Instead, use safer constructs such as std::ostringstream or at the very least, declare you char arrays much bigger than you would expect (not the best way, but would at least … Read more

C++ Swapping Pointers

Inside your swap function, you are just changing the direction of pointers, i.e., change the objects the pointer points to (here, specifically it is the address of the objects p and q). the objects pointed by the pointer are not changed at all. You can use std::swap directly. Or code your swap function like the … Read more

Get Current Time in mm/dd/yyyy in C++

I am using the following code for setting the time in a Date Control in MFC using C++ This will get the Date and set it to the control in what ever format the user machine uses. But I want to set it to a format of ONLY mm/dd/yyyy. There should be some way of … Read more

C++ JSON Serialization

For that you need reflection in C/C++, which doesn’t exist. You need to have some meta data describing the structure of your classes (members, inherited base classes). For the moment C/C++ compilers don’t automatically provide that information in built binaries. I had the same idea in mind, and I used GCC XML project to get … Read more

mysql.h file can’t be found

The mysql.h file from the libmysqlclient-dev Ubuntu package is located at /usr/include/mysql/mysql.h. This is not a standard search path for compilers, however /usr/include is. You’d typically use the mysql.h header in your code like this: If you don’t want to specify the directory offset in your source, you can pass the -I flag to gcc … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)