Article View: borland.public.cppbuilder.internet.socket
Article #5570Re: I need some suggestions and oppinion for sending data
From: Vladimir Stefanovic
Date: Sun, 08 Aug 2004 06:03
Date: Sun, 08 Aug 2004 06:03
35 lines
1792 bytes
1792 bytes
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:
<4115c231@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<41152fcb@newsgroups.borland.com> <41158ca0@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 From: "Vladimir Stefanovic" <spam@not.needed> Newsgroups: borland.public.cppbuilder.internet.socket References: <41152fcb@newsgroups.borland.com> <41158ca0@newsgroups.borland.com> Subject: Re: I need some suggestions and oppinion for sending data Date: Sun, 8 Aug 2004 08:03:22 +0200 Lines: 38 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: 213.137.116.226 Message-ID: <4115c231@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1091945009 213.137.116.226 (7 Aug 2004 23:03:29 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail