linux - Problem redirecting a C program output in bash -


I have coded a program in C which sends messages using stdout using printf and redirecting me to output Having trouble is a file (running from the bash)

I have tried:

  ./program logic & gt; & Gt; Program Out. / Program Logic & gt; Program Out. / Program & gt; & Gt; Program.out Logic. / Programs & gt; Program.out Logic  

In each case, the file programmable is created but it remains empty. The file size is 0 after the execution ends.

If I leave the redirection while executing the program:

  ./ program argument  

Then, using printf All messages sent to stdout are shown in the terminal.

I have other programs for which there is no problem redirecting my output in this way. What to do with its program? With the debate?

Some details about the C program:

  • This does not read anything from stdin
  • This uses the BSD Internet domain
  • This uses the posics thread
  • It provides a special handler function for the signal signal by using signature signage
  • For this standout I want to flush a lot to Newline.

Some code:

  int main (int argc, char ** argv) {printf (" Execution curve Commencing \ n "); ({/ * Too many printf}} while (1); / * code never reached * / pthread_exit (EXIT_SUCCESS); works only when printing on new terminal, but it is not necessary that during print When a flush is done, a quick Google search for a file  

See the section called "Default buffer mode."

You may have to add some calls to stdout, after all .

You can also set using buffer size and behavior.


Comments