Article 6QW1G Writing to file under Curses

Writing to file under Curses

by
StrayBit
from LinuxQuestions.org on (#6QW1G)
I've just discovered that I am unable to pen my LogFile.txt to add another entry after I start curses[code]#include <stdio.h>
char *FileName = "LogFile.txt";

void LogIt( char *msg )
{ FILE *fo;

fo = fopen( FileName, "a" );
fprint( fo, msg );
fclose( fo );
}

int main()
{
LogIt( "Opening log file\n" );
initscr(); /* Start curses mode */
LogIt( "This doesn't get printed!\n );
endwin();
LogIt( "But this one does.\n"
return 0;
}[\code]Upon opening the text file, you should see only 2 lines.
What am I missing?

Bruce
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments