Click here to Skip to main content
15,891,136 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Reboot PC from Program Pin
alex.barylski16-Jan-04 10:29
alex.barylski16-Jan-04 10:29 
GeneralCount of CR in an dit control Pin
Marcello16-Jan-04 8:42
Marcello16-Jan-04 8:42 
GeneralRe: Count of CR in an dit control Pin
alex.barylski16-Jan-04 10:34
alex.barylski16-Jan-04 10:34 
GeneralRe: Count of CR in an dit control Pin
Marcello16-Jan-04 11:29
Marcello16-Jan-04 11:29 
GeneralRe: Count of CR in an dit control Pin
alex.barylski16-Jan-04 11:32
alex.barylski16-Jan-04 11:32 
GeneralRe: Count of CR in an dit control Pin
Marcello16-Jan-04 12:20
Marcello16-Jan-04 12:20 
GeneralWorking with Files in Visual C++ Pin
satcat16-Jan-04 7:59
satcat16-Jan-04 7:59 
GeneralRe: Working with Files in Visual C++ Pin
Antti Keskinen16-Jan-04 8:24
Antti Keskinen16-Jan-04 8:24 
This happens because of the way you create the receiving buffer. You just create a variable that gets placed somewhere on your computer's memory. The memory contents, however, is NOT cleared. So, when you create the buffer, you can instantly use it to read and/or write characters to the memory it reserves for itself.

In order to clear the targetted area, you need to use some memory handling routines. Here is an example of how to clear the memory area:
// First, here is our buffer
char buffer[200];<DIV>

// Then we clear it's contents
ZeroMemory( &buffer[0], sizeof(buffer) );<DIV>

// Now, the buffer is ready to receive data. 
It will be filled from the first character up to the amount 'longFichero', 
and the rest of the buffer is left empty (null characters).
Hope this will help you out. An alternative method is to create a CString object, and read your data into that one. The CString object can automatically grow as a result of string operations (Append, Format, Insert etc), so you don't necessarily need to specify the amount of bytes to read.

-Antti Keskinen


----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: Working with Files in Visual C++ Pin
satcat16-Jan-04 15:22
satcat16-Jan-04 15:22 
GeneralRe: Working with Files in Visual C++ Pin
Antti Keskinen16-Jan-04 22:07
Antti Keskinen16-Jan-04 22:07 
GeneralRe: Working with Files in Visual C++ Pin
satcat19-Jan-04 9:11
satcat19-Jan-04 9:11 
GeneralRe: Working with Files in Visual C++ Pin
Antti Keskinen19-Jan-04 9:27
Antti Keskinen19-Jan-04 9:27 
GeneralRe: Working with Files in Visual C++ Pin
satcat19-Jan-04 15:04
satcat19-Jan-04 15:04 
GeneralRe: Working with Files in Visual C++ Pin
Antti Keskinen20-Jan-04 8:05
Antti Keskinen20-Jan-04 8:05 
GeneralRe: Working with Files in Visual C++ Pin
satcat20-Jan-04 13:30
satcat20-Jan-04 13:30 
GeneralRe: Working with Files in Visual C++ Pin
Antti Keskinen21-Jan-04 1:31
Antti Keskinen21-Jan-04 1:31 
GeneralRe: Working with Files in Visual C++ Pin
satcat21-Jan-04 6:08
satcat21-Jan-04 6:08 
GeneralRe: Working with Files in Visual C++ Pin
satcat26-Jan-04 0:16
satcat26-Jan-04 0:16 
GeneralRe: Working with Files in Visual C++ Pin
Antti Keskinen26-Jan-04 4:16
Antti Keskinen26-Jan-04 4:16 
GeneralRe: Working with Files in Visual C++ Pin
satcat26-Jan-04 5:08
satcat26-Jan-04 5:08 
QuestionHow to create Outlook type interface? Pin
BrockVnm16-Jan-04 7:54
BrockVnm16-Jan-04 7:54 
AnswerRe: How to create Outlook type interface? Pin
Michael P Butler16-Jan-04 8:11
Michael P Butler16-Jan-04 8:11 
GeneralRe: How to create Outlook type interface? Pin
BrockVnm16-Jan-04 8:17
BrockVnm16-Jan-04 8:17 
GeneralRe: How to create Outlook type interface? Pin
alex.barylski16-Jan-04 10:00
alex.barylski16-Jan-04 10:00 
GeneralRS232 Question Pin
srev16-Jan-04 7:30
srev16-Jan-04 7:30 

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.