I use CodeBlocks and after many trials I simply downloaded a whole project meant to save data in a text file. It works on my other computer, but on my main it simply doesn't. Haven't changed anything in both cases, just ran it straight from the unpacked folder. There is no error in the console, yet the text file remains intact, no matter what I do. Tried reinstalling CodeBlocks, checking if CodeBlocks has permission for all the stuff and still nothing. I'd be glad if it was answered, even though it's not the kind of problem expected here I guess.
Here is the code if somebody was wondering.
The file will be created in the current working directory. I'm not sure which working directory Code::Blocks uses default but it's not necessarily the same as where the executable file is located.
Still, that would not explain why it works on the other computer, under the same conditions, just downloaded and dumped on the desktop. There the file is in the folder with the executable file so I suppose it's not connected to the location of the text file.
that would not explain why it works on the other computer
Are you sure? Are you 100% certain? Have you examined the documentation of Code::Blocks to see if it changes the CWD?
My point is that in programming, "that would not explain..." is often the worst thing that you can think. Throw away your certainty and tell the computer to search the whole disk for the file.
If it's still not there then modify the program as follows:
Followed the advice, still nothing. Supposedly the file should be created (if nonexistent) in the folder of the project, I searched the whole disk and still nothing. Tried creating a file in the location but still it won't be overwritten.
Yeah, but the file is empty so the problem with overwriting the file isn't solved. I don't know how this is possible though, as the program should tell me something isn't right. I searched the disk, some other file.txts aren't hidden anywhere.
Seems to be cool after cleaning some stuff from the disk...So I'd consider this solved, although before it also seemed alright and then went down again. Anyway, thanks for the help.