Click here to Skip to main content
15,921,382 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: multi-thread question, perhaps Pin
goodoljosh19801-Feb-07 0:59
goodoljosh19801-Feb-07 0:59 
QuestionHow to get all the hardware configuration details using VC++? Pin
V.Natarajan30-Jan-07 7:44
V.Natarajan30-Jan-07 7:44 
QuestionRe: How to get all the hardware configuration details using VC++? Pin
David Crow30-Jan-07 7:48
David Crow30-Jan-07 7:48 
AnswerRe: How to get all the hardware configuration details using VC++? Pin
V.Natarajan30-Jan-07 8:08
V.Natarajan30-Jan-07 8:08 
GeneralRe: How to get all the hardware configuration details using VC++? Pin
David Crow30-Jan-07 8:16
David Crow30-Jan-07 8:16 
AnswerRe: How to get all the hardware configuration details using VC++? Pin
Hamid_RT30-Jan-07 18:20
Hamid_RT30-Jan-07 18:20 
QuestionPrivate/internal classes - opinions? Pin
charlieg30-Jan-07 7:29
charlieg30-Jan-07 7:29 
AnswerRe: Private/internal classes - opinions? Pin
led mike30-Jan-07 11:11
led mike30-Jan-07 11:11 
GeneralRe: Private/internal classes - opinions? Pin
charlieg30-Jan-07 14:03
charlieg30-Jan-07 14:03 
GeneralRe: Private/internal classes - opinions? Pin
led mike31-Jan-07 5:43
led mike31-Jan-07 5:43 
AnswerRe: Private/internal classes - opinions? Pin
Dennis Gourjii30-Jan-07 12:00
Dennis Gourjii30-Jan-07 12:00 
AnswerRe: Private/internal classes - opinions? Pin
charlieg1-Feb-07 8:40
charlieg1-Feb-07 8:40 
QuestionVisual C++ ... Visual Basic ... Visual C# [modified] Pin
Khoramdin30-Jan-07 7:18
Khoramdin30-Jan-07 7:18 
AnswerRe: Visual C++ ... Visual Basic ... Visual C# Pin
Hamid_RT30-Jan-07 7:28
Hamid_RT30-Jan-07 7:28 
AnswerRe: Visual C++ ... Visual Basic ... Visual C# Pin
Christian Graus30-Jan-07 9:20
protectorChristian Graus30-Jan-07 9:20 
QuestionRe: Visual C++ ... Visual Basic ... Visual C# Pin
Khoramdin31-Jan-07 12:52
Khoramdin31-Jan-07 12:52 
AnswerRe: Visual C++ ... Visual Basic ... Visual C# Pin
Christian Graus31-Jan-07 21:28
protectorChristian Graus31-Jan-07 21:28 
QuestionCreateFile Problem Pin
TurboNext30-Jan-07 6:27
TurboNext30-Jan-07 6:27 
I am creating a log file and writing to it in a function called WriteToLog. I am creating the file using CreateFile and writing to it using WriteFile. The problem is the filepointer is not moving and always I have only 1 sentence in my logfile, its just overwriting the file and even though I write lot of sentences into my logfile. I just see the last sentence that I wrote to it.

Any help greatly appreciated.

Thanks
Sai.


VOID WriteToLog(LPCTSTR lpszFormat, ...)
{
CString csT1,csT2;
va_list args;
BOOL bRet=FALSE;
HANDLE hFile=NULL;
SYSTEMTIME stTime;
DWORD dwT1=0;

va_start(args, lpszFormat);
csT1.FormatV(lpszFormat,args);
va_end(args);

CSingleLock oLockcopyCounter(&g_oMessageOutputSection);


oLockcopyCounter.Lock();
GetLocalTime(&stTime);
csT2.Format("%s[0x%x] %02d/%02d/%04d %02d:%02d:%02d.%03d: %s", "\r\n",GetCurrentThreadId(),stTime.wMonth, stTime.wDay,
stTime.wYear, stTime.wHour, stTime.wMinute, stTime.wSecond, stTime.wMilliseconds,(PCHAR)(LPCTSTR)csT1);
hFile=CreateFile(g_szLogFileName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile!=INVALID_HANDLE_VALUE)
{
if(GetFileSize(hFile,NULL)> (5*1024*1024))
{
CloseHandle(hFile);DeleteFile(g_szLogFileName);
ReportAsEvent(EVENTLOG_INFORMATION_TYPE,0,"Deleting File %s since it croseed 5 MB Limit",g_szLogFileName);
hFile=CreateFile(g_szLogFileName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
}
if(hFile!=INVALID_HANDLE_VALUE)
{
WriteFile(hFile,csT2,csT2.GetLength(),&dwT1,NULL);
WriteFile(hFile,csT2,csT2.GetLength(),&dwT1,NULL);
CloseHandle(hFile);
}
else
ReportAsEvent(EVENTLOG_ERROR_TYPE,0,"Creating File %s FAILED. Error %d",g_szLogFileName,GetLastError());
}
oLockcopyCounter.Unlock();
}
AnswerRe: CreateFile Problem Pin
David Crow30-Jan-07 6:31
David Crow30-Jan-07 6:31 
AnswerRe: CreateFile Problem Pin
Mark Salsbery30-Jan-07 6:36
Mark Salsbery30-Jan-07 6:36 
GeneralRe: CreateFile Problem Pin
TurboNext30-Jan-07 6:58
TurboNext30-Jan-07 6:58 
QuestionMaking strong passwords readeable Pin
Kharfax30-Jan-07 4:14
Kharfax30-Jan-07 4:14 
AnswerRe: Making strong passwords readeable Pin
Maximilien30-Jan-07 6:23
Maximilien30-Jan-07 6:23 
GeneralRe: Making strong passwords readeable Pin
Kharfax30-Jan-07 6:38
Kharfax30-Jan-07 6:38 
AnswerRe: Making strong passwords readeable Pin
markkuk30-Jan-07 23:00
markkuk30-Jan-07 23:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.