after call to following function i cant write to any files i tried c++ fstream and c\'s fopen what\'s wrong please help thanks in advance i am using codeblocks mingw windows
If you change folder in the dialog it will change the current folder for your process - try adding the OFN_NOCHANGEDIR
flag.
Try CreateFile and WriteFile.
string s = "file.dat";
HANDLE hFile = CreateFile(s.c_str(), // name of the write
GENERIC_WRITE, // open for writing
0, // do not share
NULL, // default security
CREATE_ALWAYS, // Creates a new file, always
FILE_ATTRIBUTE_NORMAL, // normal file
NULL); // no attr. template
DWORD writesBytes;
bool writeok = WriteFile(hFile, &Current_Doc, sizeof(Current_Doc), &writesBytes, NULL);
CloseHandle(hFile);
Similar problem, and my answer is here:
OPENFILENAME open dialog