| 2.1.10.37 log_file
 DescriptionWe will always open and write(append) log files and then close so that it is crash proof
debug log file store at your Origin home directory
 Syntaxint log_file( LPCSTR lpcsz, BOOL bWrite ) Parameters lpcsz[input]if not NULL:if bWrite=true,lpcsz is the string to be written into debug log fileif bWrite=false,create user define debug log file named lpcszif NULL:if bWrite=true,reset to no-log-file state;if bWrite=false,return the status of log-file process bWrite[input] usage refer to lpcsz
 Returnif lpcsz not NULL
 if bWrite =true,if write the string into log file seccessfully,return the length of the string,else return -1
 if bWrite =false,if create a new log file successfully,return 0,else return -1
 if lpcsz = NULL
 if bWrite = true,return 0
 if bWrite =false,if log_file started return 1,else return -1
 ExamplesEX1
 void log_file_ex1()
{
	string strFile = "C:\\myLog.txt";
	if ( log_file(strFile, false) == 0 ) //create successfully
	{
		log_file("some message...", true); //log some message
		int nstate = log_file(NULL, false); //query state of log-file process
		ASSERT(nstate == 1);
		log_file(NULL, true); //reset to no log state
		log_file("Can not log this message!", true); //try to log, this will fail since log-file process is reset
		//after this code, you may find a file and check the content in it.
	}
}RemarkSee AlsoHeader to Includeorigin.h
 Reference |