Applicable VersionsNetSim StandardNetSim Pro


Applicable Releasesv10.2v11.0v12v13


In NetSim printf() is customized, and 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.

Where,

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.


Website: For more information on NetSim visit https://www.tetcos.com