title: Is it possible to detect just the new line input with scanf?
body: <p>I want to reproduce a terminal behavior, and if possible using <code>scanf</code>:</p>
  
  <p>When the user just inputs a new line, the terminal keeps printing the directory, until a real command is inserted.
  The normal behavior of the function <code>scanf</code> when a new line is inserted, is to keep jumping empty lines waiting for the user to really insert a valid character.</p>
  
  <p>Observation: this terminal simulation is running while i execute ./main.out , this means i'm not talking about my OS terminal, i'm talking about a simulated terminal in C to my program.</p>
  
  <p>what usually happens with <code>scanf</code> when you insert empty lines: </p>
  
  <pre><code>realPC:~/realDirectory$ ./main.out //starting our simulated terminal
  pc:~/Desktop$ '\n'
  '\n'
  '\n'
  "COMMAND\n"         //PROCESS THE COMMAND!
  pc:~/Desktop$       //waiting...
  </code></pre>
  
  <p>what i want: </p>
  
  <pre><code>realPC:~/realDirectory$ ./main.out //starting our simulated terminal
  pc:~/Desktop$ '\n'
  pc:~/Desktop$ '\n'
  pc:~/Desktop$ '\n'
  pc:~/Desktop$ "COMMAND\n" //Process the command here
  pc:~/Desktop$             //waiting...
  </code></pre>
  
  <p>This directory is just an example, i want to print any message (for example, keep printing arrows <code>"&gt;&gt;&gt;"</code> after empty inputs), the problem is that <code>scanf</code> seems to don't even consider <code>'\n'</code> a input, so i can't print anything</p>
  
  <p>I know that <code>fgets(userInput, 1024, stdin)</code> works instead of scanf, but i'd like to know if it is possible using the scanf function (i'm not used to fgets, i'm also accepting other solutions sugestions too, if possible)</p>
  
  <p>Here's the code (the <code>scanf</code> isn't working on both uses as i'm pretending to):</p>
  
  <pre><code>int main()
  {
      char userInput[1024];
      char pwd[] = "pc:~/marcospb19"; // Directory that keeps being printed
  
      while (1)
      {
          printf("%s$ " , pwd); // Print the directory just like terminals do
  
          scanf(" %s" , userInput); // I wanted this to enter the while and keep printing directory
          while (userInput[0] == '\n') // Keeps the input inside the loop, if is a new line
          {
              puts("We're inside this loop! that's good, now keep printing directory...");
              printf("%s$ " , pwd); // Directory printed, next: take input again
              scanf(" %s" , userInput); // This should be able to receive '\n'.
              // This loop should continue if user types '\n'
          }
  
          // Now, you can process the input, it isn't empty!
          printf("Process the input: %s\n", userInput);
      }
  }
  </code></pre>
  
  <p>Obviously, when i say the user types <code>'\n'</code>, he is just hitting the enter key (not really typing it).</p>