ofstream is not writing!!
Guys, i'm having trouble with my code... I just can't find any mistake, and this is freaking me out! It should open a file used as a Database, to write data in binary mode... But it does not write...
Please, someone help me: Code:
void DatabaseHelper::EnsureInitialized() |
Re: ofstream is not writing!!
I dont see any easy mistakes there but that code may not be what is causing the problem. Are you sure you are closing the files properly after you have written everything to the file okay??
Ps i cant see all of the code because of my browser |
Re: ofstream is not writing!!
Do your strings already have the slashes, dots and such in them? You are appending them without adding them if so.
Try std::fstream::app|std::fstream::out. I've never tried just app |
Re: ofstream is not writing!!
I changed my code here as DrEvil said:
Code:
DatabaseHelper::write.open(destination.c_str(), std::fstream::app | std::fstream::out); Code:
if (!DatabaseHelper::write) closing the stream after writing as Cheseeh said did not help too. From ios_base.h Quote:
Thank you very much guys... Any help will be very apreciated! |
Re: ofstream is not writing!!
Problem solved(?)...
If I use a Code:
<<std::endl; I'ts not a solution, but it's helping... |
Re: ofstream is not writing!!
Just for the sake of "it shouldn't do anything but try it anyway" use ostream or iostream instead of ofstream.
|
All times are GMT +2. The time now is 04:35. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.