Notice: Undefined offset: 16169323 in /var/www/html/qa-external/qa-external-users.php on line 744
I have a program that is supposed to write output to a .txt file does it work with gdb? - OnlineGDB Q&A
Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

I have a program that is supposed to write output to a .txt file does it work with gdb?

+17 votes
asked Mar 18, 2018 by Fabian
so my program is set to write output to both"example.txt" and standard output. i created another file in the online compiler called "example.txt" but the compiler doesnt write to it.

is this something that can only be done in a local compiler or do i have to do something else to either :

 get it to write to a file in the online compiler,

get it to write to a file on my computer

3 Answers

0 votes
answered Mar 19, 2018 by Shane Such (860 points)
i tried it out  with c++ and it worked but i don't know where the file is that i wrote to so yes and no
asked Jun 21, 2018 by Kristi Hansen (120 points) Where is a file I create with fstream located on my local hard drive?
commented Aug 18, 2018 by Ethan Alexander Lee (580 points)
I'd just download either Code::Blocks or Visual Studio.
http://www.codeblocks.org/                        - Basic C/C++ environment with project capability.
https://visualstudio.microsoft.com/          - Larger but more advanced environment with the
                                                                                  ability to program in several languages and add-ons.
0 votes
answered May 24, 2025 by Admin (5,870 points)
File created during program execution will be created on server and will be visible in editor once program execution is over.
0 votes
answered Aug 15, 2025 by (150 points)
I have been fighting this issues for 2 days now. I started a completely new project to confirm suspicions as well.  The code appeared to work correctly last night, immediately creating the files as it is supposed to do. This morning, excited to get back to it and complete my project, it is right back to not creating the files until I use sys.exit() to end the program. Using the stop button to end the program does not generate the files either. Running the same script on my local installation generates the file immediately, allowing the program to function as it is supposed too.

This appears to be a limitation in the virtualized IDE, and I think I will develop locally first, then see if I can get it to run normally on GDB.
commented Aug 22, 2025 by Jerry Jeremiah (2,040 points)
Yes, you can't use the stop button to finish the program.
The program has to stop by itself - either because it gets to the end or because you use sys.exit()
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...