+ 3

[SOLVED] Why can’t I output to a file? (C++)

https://code.sololearn.com/clWvh3t7pM16/?ref=app I made this program to output itself and before that, add “hello” to the file, but it isn’t changing the file at all. Writing the file’s contents works just fine, but not modifying it. I tried with both C++ ofstream and C FILE*.

3rd Feb 2018, 3:36 PM
Jacob Pembleton
Jacob Pembleton - avatar
3 Respuestas
+ 2
@Jacob Pembleton Is the name of every C++ program being compiled on the Sololearn Compiler called 'source.cpp'?
4th Feb 2018, 10:16 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 2
@Kinshuk Vasisht Yes, all programs here are source.(extension name), besides maybe web because of multiple files for HTML, CSS, and JS.
4th Feb 2018, 3:35 PM
Jacob Pembleton
Jacob Pembleton - avatar
+ 1
Thank you very much. I just had another query. Do you know what happens when multiple users try to compile codes in the same language at the same time? Does the name remains the same or does it change to something else? // I agree these are very rare cases. // But this may be the reason at times // our codes do not compile... right?
4th Feb 2018, 4:30 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar