Hi, i have included the main parts of my code to give an idea of whats going on. Bascally within an if statement i make a folder at path 'OUTPUT_Folder_name'. I then test that is open and even when i go and search for it it does get created. However when i use 'OUTPUT_Folder_name' as the new path name for the 'ofstream' later in the code it won't write anything into the newly created folder and it should be writing files to it.
Can anyone offer a suggestion as to what i'm doing wrong?
I hope ive explained what im trying to do well enough
CODE
(if val=1)
{
string my_string1 = "c:\\temp\\mine\\";
string my_string3 = FILE_NAME1;
string OUTPUT_Folder_name = my_string1 + my_string3;
mkdir(OUTPUT_Folder_name.c_str());
struct stat info;
int Z = stat(OUTPUT_Folder_name.c_str(),&info);
if (Z == 0)
{
char *buffer = new char[Size_of_the_file1];
ifstream myFile ("C:\\temp\\usbimage4.txt", ios::in | ios::binary);
myFile.seekg (start_byte1,std::ios::beg);
myFile.read(buffer, Size_of_the_file1*sizeof(char));
ofstream g(OUTPUT_Folder_name.c_str(), ios::out | ios::binary);
g.write(buffer, Size_of_the_file1*sizeof(char));
g.close();
}
}
Thank you