fstream datoteka;
datoteka.open("Informacije.txt", fstream::in | fstream::out | fstream::app);
if(!datoteka.is_open()){
ifstream datoteka("Informacije.txt")
datoteka.open("my_file.txt", fstream::in | fstream::out | fstream::app);
}/*I'm writing IN the file outside of that if statement.
So what it should do is create a file if it was not created before, and if it is created write into that file.
Hello there, so what I wanted from my program is that it check if the file already exists, sothe program open if it does and I can write in it, if the file is not opened(have not been created before) the program create it. So the problem is when I create a .csv file, and finish writing and I wanted to check if the written is really there, the file cannot be opened. In .txt file, everything is blank.
datotekain the if-block the file is closed. The original outside the if-block was never opened, so anything you're do to that doesn't actually "do" anything. (I can only imagine the unchecked IO you didn't post) What is the point of thedatotekain the if-block anyway?