Article View: borland.public.cppbuilder.nativeapi
Article #16339Are nulls required to make buffers strings?
From: Bill Carson
Date: Fri, 16 May 2003 19:30
Date: Fri, 16 May 2003 19:30
29 lines
2052 bytes
2052 bytes
I've been learning to use the WIN32 API function ReadFile() to read in text to an edit control using the SetWindowText() function. During this process I have seen that Petzold appends null characters to the buffer that receives data before sending the text to an edit control (in his Poppad3 example, Chapter 11). But, I've noticed if I skip this step and compile Poppad3, the result is the same. The buffer is still used by SetWindowText to fill the edit control whether I append a null character or not. I don't fully understand the buffer returned by ReadFile(), and have searched without luck for a detailed description on MSDN and Google. I assume it is just a pointer to a block of memory I allocate with the value I get from GetFileSize(), so it should not be considered a string by SetWindowText(). Is it safe to assume that ReadFile() never returns a null character in the buffer after a read? Or, does it place one there after a read? If anyone can point me to a discussion of the buffer used by ReadFile(), it would be most helpful. Thanks, Bill
Technical Details
Message-ID:
<3ec53c62@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,ba9583b134269b63,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-05-16 12:40:53 PST From: "Bill Carson" <bcarson892003atyahoodotcom> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Are nulls required to make buffers strings? Date: Fri, 16 May 2003 12:30:22 -0700 Lines: 31 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 NNTP-Posting-Host: 66.119.208.252 Message-ID: <3ec53c62@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1053113442 66.119.208.252 (16 May 2003 12:30:42 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail