Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am a new to C. I had written a code in C and want to generate a log file for all errors and unsupported functionality. How can I create a log file for a program?

My program structure is like:

main()
{ 
  int i = abc();
  if (i != 0)
    //put error in log file

  int j = PQR();
  if ( j != 0)
    //put error in log file
}
abc()
{
 int k = xyz();
 if ( k != 0)
    //put error in log file
}
PQR()
{
 //some code
}
xyz()
{
 //some code
}

Please help me out.
Thanks in advance.
Posted
Updated 27-May-10 23:04pm
v4

Log4C is what i found most of the people using.

Have a look at these ways of logging in C:
Log4c : Logging for C Library[^]
Adding Logging to C Programs with the Pantheios C API[^]
http://stackoverflow.com/questions/613919/c-logging-apis[^]
 
Share this answer
 
Thak you so much for the reply. :-O
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900