Click here to Skip to main content
15,917,177 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDatabase connection in vc++ Pin
ningthemcha24-Jul-06 1:04
ningthemcha24-Jul-06 1:04 
AnswerRe: Database connection in vc++ Pin
_AnsHUMAN_ 24-Jul-06 1:19
_AnsHUMAN_ 24-Jul-06 1:19 
AnswerRe: Database connection in vc++ Pin
David Crow24-Jul-06 2:59
David Crow24-Jul-06 2:59 
QuestionDisplaying the content of control to new form contron Pin
ningthemcha24-Jul-06 1:02
ningthemcha24-Jul-06 1:02 
AnswerRe: Displaying the content of control to new form contron Pin
_AnsHUMAN_ 24-Jul-06 2:33
_AnsHUMAN_ 24-Jul-06 2:33 
AnswerRe: Displaying the content of control to new form contron Pin
Hamid_RT24-Jul-06 2:41
Hamid_RT24-Jul-06 2:41 
QuestionRe: Displaying the content of control to new form contron Pin
David Crow24-Jul-06 3:03
David Crow24-Jul-06 3:03 
Questionasynchronized I/O == multiplexing I/O? Pin
George_George24-Jul-06 0:57
George_George24-Jul-06 0:57 
AnswerRe: asynchronized I/O == multiplexing I/O? Pin
peterchen24-Jul-06 2:12
peterchen24-Jul-06 2:12 
GeneralRe: asynchronized I/O == multiplexing I/O? [modified] Pin
George_George25-Jul-06 2:06
George_George25-Jul-06 2:06 
QuestionSet Focus to Button? Pin
bosfan24-Jul-06 0:37
bosfan24-Jul-06 0:37 
AnswerRe: Set Focus to Button? Pin
toxcct24-Jul-06 0:41
toxcct24-Jul-06 0:41 
GeneralRe: Set Focus to Button? Pin
bosfan24-Jul-06 1:09
bosfan24-Jul-06 1:09 
AnswerRe: Set Focus to Button? Pin
_AnsHUMAN_ 24-Jul-06 0:42
_AnsHUMAN_ 24-Jul-06 0:42 
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 

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.