🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: I need some suggestions and oppinion for sending data

#5471
From: Daniele Borini
Date: Sun, 08 Aug 2004 09:49
47 lines
2272 bytes
yes, but i suggest you to use only one write such as:

AnsiString s=AnsiString('1')+rec_str;
fwrite(s.c_str(),sizeof(char),len,File);

that's 'couse on the other side of the transmission u'll get data with 
only one read.. more faster...

Vladimir Stefanovic wrote:
> Thanks Daniele,
> 
> I'll consider your suggestions.
> 
> Now, I have found in the '...students' group some code that Remy
> supplied for 'Easy way to save struct data to file':
> 
> These are fragments, and I think I can use it after slite modifications
> 
> [...]
>     void WriteAnsiString(FILE *File, const AnsiString &Str)
>     {
>         int len = Str.Length();
>         fwrite(&len, sizeof(int), 1, File);
>         if( len > 0 )
>             fwrite(Str.c_str(), sizeof(char), len, File);
>     }
> 
> [...]
>     void ReadAnsiString(FILE *File, AnsiString &Str)
>     {
>         int len = 0;
>         fread(&len, sizeof(int), 1, File);
>         if( len > 0 )
>         {
>             Str.SetLength(len);
>             fread(Str.c_str(), sizeof(char), len, File);
>         }
>         else
>             Str = "";
>     }
> 
> 
> Best regards,
> Vladimir Stefanovic
> 
> 
> 
Technical Details
Message-ID: <4115f72f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <41152fcb@newsgroups.borland.com> <41158ca0@newsgroups.borland.com> <4115c231@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,9e55e8bf383b51eb
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Sun, 08 Aug 2004 11:49:28 +0200
From: Daniele Borini <borini@infinito.it>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.1) Gecko/20040707
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: I need some suggestions and oppinion for sending data
References: <41152fcb@newsgroups.borland.com> <41158ca0@newsgroups.borland.com> <4115c231@newsgroups.borland.com>
In-Reply-To: <4115c231@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 62.94.232.149
Message-ID: <4115f72f$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1091958575 62.94.232.149 (8 Aug 2004 02:49:35 -0700)
Lines: 47
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail