Maybe I’m tired, but I can’t figure out why this code creates an empty file :
[code]// At this point, we have a someString object of type juce::String which is correctly filled, according to the debugger.
juce::OutputStream* os=someFile.createOutputStream();
os->writeString(someString);
os->flush();
delete os;[/code]
The file object (someFile), is created, at the right place, but…it’s empty. The string “smeString” is not empty though. No idea why it happens. Any clues ?
True, I should have used writeText instead. However, I tried it and …same result : 0 bytes file ! :o
I also tried File::appendText , File::replaceWithText with the same result too. Can you see any reason why this would happen ? The weirdest thing is that those functions return true, indicating success !
Can this be a cache problem (but I call flush and delete) ?
Can it be that juce faills to copy from a temp file to the actual file ?
It’s more likely that you’re not actually writing to the file that you think you are. Print out the file name to check it, and step through it in your debugger to see what’s happening - chances are that it’ll be a simple mistake.