In NetSim printf() is customized, for which the syntax is available in main.h file. Both fprintf(stdout,"") and printf("") statements are used to write to NetSim's log file (LogFile.txt).

printf("") sends formatted output to stdout.

printf() is customized in NetSim to print to the stdout which normally writes to LogFile.txt.

The definition for printf("") can be found in main.h file towards the end of the file.

#define printf(x,...) {printf("\n%s:%d:  ",__FILE__,__LINE__);printf(x,__VA_ARGS__);}

printf("") additionally prints the file name and line number in addition to whatever is provided within the quotes to LogFile.txt.

In NetSim, fprintf(stderr,"") and fprintf(stdout,"") statements are used as per C. 

fprintf(stdout,"") writes whatever is provided within the quotes to LogFile.txt.

fprintf(stderr,""); Prints whatever is provided within the quotes, to the console.


stdout and stderr are both output streams.

stdout is a stream where the program writes output data. 

stderr is an output stream typically used by programs to output error messages or diagnostics to the console.

Users can contact us via our web contact form