# Function println/printf

Thread Starter

#### Ryan$Joined Dec 14, 2018 178 Hi guys; The function printf is prompting the pc for opening a Command Prompt Window( the black screen of the compiler ); my question is .. When I call twice the function printf for example: Code: Printf("hello"); Printf("world"); At first call of printf the command window is prompeted; once i call the second call; the pc will figure out that command prompt is already opened(prompted) ..so he will just print over it or openning it again? If openening it again then would be more than one command prompt opened and it's nonsense .. So how pc works when finding it already opened/prompted? By the way it doesn't matter which language of programming I'm talking about.[/code] #### wayneh Joined Sep 9, 2010 17,153 In my experience all printing to the console occurs within a single window. #### sirch2 Joined Jan 21, 2013 1,029 For two lines of code you might as well just try it and see what happens, however since I have started typing, printf does not prompt the PC to open the command prompt window. Depending on the environment and type of application a console window may be opened when the application is invoked. After that there is one stdout (standard output) stream and unless you redirect stdout all printf's will go to stdout and appear in the console window. (Google will help you with terms like "stdout" and "console window") #### WBahn Joined Mar 31, 2012 26,398 Hi guys; The function printf is prompting the pc for opening a Command Prompt Window( the black screen of the compiler ); my question is .. When I call twice the function printf for example: Code: Printf("hello"); Printf("world"); At first call of printf the command window is prompeted; once i call the second call; the pc will figure out that command prompt is already opened(prompted) ..so he will just print over it or openning it again? If openening it again then would be more than one command prompt opened and it's nonsense .. So how pc works when finding it already opened/prompted? By the way it doesn't matter which language of programming I'm talking about.[/code] Have you actually tried it? What happened? The printf() command does NOT prompt the PC to open a console window. If you have a console application, then the console is opened as soon as your program starts running whether you print anything to it or not. Thread Starter #### Ryan$

Joined Dec 14, 2018
178
Have you actually tried it?

What happened?

The printf() command does NOT prompt the PC to open a console window. If you have a console application, then the console is opened as soon as your program starts running whether you print anything to it or not.
I tried what happens actually one consol opened; but just curious if what I claiming is actually what pc is doing.
I asked like this question although I already tried .. Just to know how exactly pc works because Im just making an imagination behind the scene of what's going on without really/actually know exactly that's what's pc done; maybe I must chabge tgis approch to actually doesn't matter how actually pc is doing an operation; what actually matter how visualizing it right!

#### wayneh

Joined Sep 9, 2010
17,153
They say in UNIX that everything is a file. So when I program in OS X or iOS, any "print" command writes to a file. The default is that an unspecified location is the console and is one "file". I think I could create more consoles but it would take some research on my part to figure out how to do that and to then get them to show within Xcode (my IDE). I already have logging commands that are directed to the console while I'm working and to a file on the users device when the app is actually running.

Similar threads