MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / WriteToLog

Method WriteToLog

UTCP/src/uh_ctrl.cpp:1542–1566  ·  view source on GitHub ↗

WriteToLog Internal function Params string - the string to write to the log newline - TRUE if a new line is to be added after the string Return 0 - (UH_SUCCESS) 1 - (UH_ERROR) ***********************************************/

Source from the content-addressed store, hash-verified

1540 1 - (UH_ERROR)
1541***********************************************/
1542void CUH_Control::WriteToLog(LPCTSTR string,int newline){
1543
1544 //check to see if the date has changed
1545 time_t t = time(NULL);
1546 struct tm * lt = localtime(&t);
1547 if(m_logDay != lt->tm_mday || m_logMonth != lt->tm_mon ||
1548 m_logYear != lt->tm_year){
1549 OpenLog();
1550 }
1551
1552 if(m_fileHandle == NULL)
1553 return;
1554
1555 if(newline)
1556 fwrite("\n",sizeof(char),1,m_fileHandle);
1557#if defined _UNICODE
1558 size_t size = _tcslen(string);
1559 char * buffA = (char*) alloca(size+1);
1560 *buffA = '\0';
1561 CUT_Str::cvtcpy(buffA, size, string); // convert to ANSI
1562 fwrite(buffA,sizeof(char),_tcslen(string),m_fileHandle);
1563#else
1564 fwrite(string,sizeof(char),_tcslen(string),m_fileHandle);
1565#endif //_UNICODE
1566}
1567
1568#if defined _UNICODE
1569int CUH_Control::AddLine(LPCSTR string, COLORREF TextColor, COLORREF BackColor, BOOLEAN addToLog)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected