2nd edit
Some clarifying...
I wrote a C program that asks for input (in this case, using fgets()
). When I compile it into a C executable, I notice this behavior:
If I run the executable from the terminal like: ~$ ./program_name
obviously the terminal session continues after the process is completed. I am greeted with a blank command line, as usual: ~$
However, if I run the executable by double-clicking the C executable file, a terminal comes up and I am able to input data, as the program asks. After the data is inputted the process ends, the "terminal" says [Process completed]
and the terminal is apparently unusable.
When I run a C executable in OSX that allows terminal input (via fgets()
, for instance), after the information is entered the message [Process completed]
appears and the terminal seems unusable. This is inconvenient for my purposes.
Questions: Let's assume I'm running it without a terminal open. So i'm double clicking the program.
Is there a way to remain in the terminal after executing the C program via a command line input?
- My program asks for input, so I can give it input that can
echo
in the shell... is there any way/command to remain in the terminal? Spawning a new terminal is an option, but it is far less desirable.
- My program asks for input, so I can give it input that can
Is there a way to remain in the terminal by altering my C program?
Additional question: Is there a terminal command to spawn a new terminal window?
All ideas are welcome...! I have some, but nothing satisfactory, yet.
~$ ./program_name
A little bit of both: I read about it in a book, implemented it, and encountered this not discussed behavior.