Click here to Skip to main content
15,889,335 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Set Focus to Button? Pin
bosfan24-Jul-06 1:26
bosfan24-Jul-06 1:26 
QuestionReading text from where mouse is double clicked!!! Pin
_AnsHUMAN_ 24-Jul-06 0:20
_AnsHUMAN_ 24-Jul-06 0:20 
AnswerRe: Reading text from where mouse is double clicked!!! Pin
Programm3r24-Jul-06 0:31
Programm3r24-Jul-06 0:31 
AnswerRe: Reading text from where mouse is double clicked!!! Pin
David Crow24-Jul-06 3:08
David Crow24-Jul-06 3:08 
Questionread/ write to screen/ file Pin
tanarnelinistit24-Jul-06 0:05
tanarnelinistit24-Jul-06 0:05 
AnswerRe: read/ write to screen/ file Pin
Cedric Moonen24-Jul-06 0:14
Cedric Moonen24-Jul-06 0:14 
GeneralRe: read/ write to screen/ file Pin
tanarnelinistit24-Jul-06 0:18
tanarnelinistit24-Jul-06 0:18 
AnswerRe: read/ write to screen/ file Pin
normanS24-Jul-06 0:58
normanS24-Jul-06 0:58 
I can't see a problem with your code.

As Cedric said, your code will overwrite anything that is already in the file. You can work round this by opening the file then moving to the end before writing, something like this:

DWORD dwBytesRead = 0, dwBytesWritten;
char szBuffer[101];
static HANDLE hFileHandle = INVALID_HANDLE_VALUE;

serial.Read(szBuffer,sizeof(szBuffer)-1,&dwBytesRead);
if (dwBytesRead > 0)
{
szBuffer[dwBytesRead] = '\0';
hFileHandle = CreateFile(szLogFileName, GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH, NULL);
SetFilePointer( hFileHandle, 0, NULL, FILE_END);
WriteFile(hFileHandle, (LPCVOID) szBuffer, dwBytesRead+1, &dwBytesWritten, NULL);
printf("%s", szBuffer);
fclose(out);

// Check if EOF (CTRL+'[') has been specified
if (strchr(szBuffer,EOF_Char))
fContinue = false;

} 

GeneralRe: read/ write to screen/ file Pin
tanarnelinistit24-Jul-06 1:16
tanarnelinistit24-Jul-06 1:16 
GeneralRe: read/ write to screen/ file Pin
normanS24-Jul-06 19:25
normanS24-Jul-06 19:25 
QuestionHow to hide process from being watched Pin
kflrei24-Jul-06 0:02
kflrei24-Jul-06 0:02 
AnswerRe: How to hide process from being watched Pin
Programm3r24-Jul-06 0:11
Programm3r24-Jul-06 0:11 
AnswerRe: How to hide process from being watched Pin
Programm3r24-Jul-06 0:17
Programm3r24-Jul-06 0:17 
QuestionIPC -- is it reliable ??? Pin
TamirC23-Jul-06 23:53
TamirC23-Jul-06 23:53 
AnswerRe: IPC -- is it reliable ??? Pin
ThatsAlok24-Jul-06 0:02
ThatsAlok24-Jul-06 0:02 
QuestionOnKillFocus() Pin
Taruni23-Jul-06 23:26
Taruni23-Jul-06 23:26 
AnswerRe: OnKillFocus() Pin
prasad_som24-Jul-06 1:53
prasad_som24-Jul-06 1:53 
AnswerRe: OnKillFocus() Pin
David Crow24-Jul-06 3:21
David Crow24-Jul-06 3:21 
QuestionGetting folder names Pin
ashokvishnu23-Jul-06 23:26
ashokvishnu23-Jul-06 23:26 
AnswerRe: Getting folder names Pin
Don Box23-Jul-06 23:35
Don Box23-Jul-06 23:35 
AnswerRe: Getting folder names Pin
toxcct23-Jul-06 23:46
toxcct23-Jul-06 23:46 
AnswerRe: Getting folder names Pin
ThatsAlok24-Jul-06 0:00
ThatsAlok24-Jul-06 0:00 
QuestionRe: Getting folder names Pin
David Crow24-Jul-06 3:25
David Crow24-Jul-06 3:25 
QuestionHow to create Toolbar by using resources Pin
johnalek23-Jul-06 22:41
johnalek23-Jul-06 22:41 
AnswerRe: How to create Toolbar by using resources Pin
toxcct23-Jul-06 22:54
toxcct23-Jul-06 22:54 

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.