So my problem is that my program runs very fast so that I do not think how it behaves. It should crawl the text with the edges of the terminal. I tried to make a short break between This is what it looks like: So I put the Function () function after ==================================== = ================================================= ==== EDIT: OK, I put it on my own. It seems that So if you have The result will be: [pause for 3 seconds] [Pause for 3 seconds] But if You remove the new line [Break for 9 seconds] I do not know why this happens, but it just does Is ========================================== ===== =================================== EDIT: In this way I wanted to work for my work Rum: Thank you for your reply Your comments are not the reason Then first You can output buffer of printf (...) s to use
sleep () so that I can see where this text is going is. / P>
printf So that it breaks the loop before starting again and move the text gradually, but what happens is that it prevents programs indefinitely even before the program starts. It also happens with
sleep and
system ("pause 1") . This is what looks like this:
sleep () works only when I put
\ n in my string I do not know why I did not even read it in very manual.
printf ("hello \ n"); Sleep (3); Printf ("hello \ n"); Sleep (3); Printf ("hello \ n");
Hello
Hello
Hello
Hello Hollow Hollo
So () is not working, but by the fact that
uses printf ()
stdout , which is the line buffer "line Buffer "means the buffer's content of buffer that is written on
stdout is buffer until the content is reached before the remaining.
printf ("helo"); The output does not go to the screen but remains in buffer, then
Sleep (1); is executed and you wait for the next
printf ("HELLO"); The output still does not go to the screen, but the following
sleep (1); Again you will have 1 second ... and so on until a line end in your program by a
\ n or by the end of the program, which flushes the output buffer in the console.
stdout to each
printf () :
#include & lt; Stdio.h & gt; After flushing can avoid behavior. # Include & lt; Unistd.h & gt; Int main (zero) {printf ("hello"); Fflush (stdout); Sleep (3); Printf ("hello"); Fflush (stdout); Sleep (3); Printf ("hello"); / * Fluff (standout); * / / * Is not required because buffers are flipped at the end of the program / / 0 returns; }
No comments:
Post a Comment