🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #2959

Re: TWinSocketStream Read in BYTE buffer

#2959
From: newsgroups.borland.com
Date: Thu, 29 Dec 2005 19:41
42 lines
2590 bytes
   TMemoryStream *DataStream = new TMemoryStream;
.
.
.

>                             while( datasize > 0 )
>                             {
>                                 bufsize = datasize;
>                                 if( bufsize > sizeof(rbuf) )
>                                     bufsize = sizeof(rbuf);
>
>                                 if( !ReadBuf(str, rbuf, bufsize) )
>                                 {
>                                     error = true;
>                                     break;
>                                 }
>
>                                 // write rbuf to the file, up to bufsize
bytes ...
>
>                                 datasize -= bufsize;
>                             }

                                DataStream->Write(rbuf, bufsize);
<----- What I added
                                DataStream->SaveToFile( "maurice.ini" );
<----- What I added
>
>                             // close the file ...
>

The contents of 'maurice.ini', is garbled.  It looks like this:
         �� �|�w       �X|8�  o� U�w(%�w����

Any ideas why this is happening?

Also, I have a quick question about function ReadBuf(TStream *Strm, void
*Buffer, int Count).  In the function you have
pBuf += NumRead.  Why are you adding the number of bytes read to our data?
Sorry if it's a dumb question, but I am still learning..

Thanks.
Technical Details
Message-ID: <43b43a5a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <43ac3d34$1@newsgroups.borland.com> <43ac6028$1@newsgroups.borland.com> <43acc4c5$1@newsgroups.borland.com> <43ae5b51$1@newsgroups.borland.com> <43aeebe1$1@newsgroups.borland.com> <43aef70e$1@newsgroups.borland.com> <43af06d7$1@newsgroups.borland.com> <43b252fa$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,74cdc31c66b3abd9
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII
From: "newsgroups.borland.com" <mauriceanderson@hotmail.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <43ac3d34$1@newsgroups.borland.com> <43ac6028$1@newsgroups.borland.com> <43acc4c5$1@newsgroups.borland.com> <43ae5b51$1@newsgroups.borland.com> <43aeebe1$1@newsgroups.borland.com> <43aef70e$1@newsgroups.borland.com> <43af06d7$1@newsgroups.borland.com> <43b252fa$1@newsgroups.borland.com>
Subject: Re: TWinSocketStream Read in BYTE buffer
Date: Thu, 29 Dec 2005 11:41:13 -0800
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 64.30.203.223
Message-ID: <43b43a5a$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1135884890 64.30.203.223 (29 Dec 2005 11:34:50 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail