> Date: Wed, 02 Aug 2006 09:16:25 -0600
> From: Stephen Posey <[EMAIL PROTECTED]>
> Subject: Re: Telnet, Indy9, text file conversion;
> To: Borland's Delphi Discussion List <[email protected]>
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Mick Arundell wrote:
> >> Date: Tue, 01 Aug 2006 11:22:37 -0600
<<snip out my embarrassing mistakes>>


> > fairly sure it goes like that but out of practice.
> 
> To use Read() like that, Standard Pascal (and AFAIK Delphi) expects data 
> values separated by white space (Space characters, and maybe Tab 
> characters, haven't tried that).
> 
> Commas are interpreted as extraneous character data that prevents 
> reading the values as-is.
> 
> So, expanding your example a little, some code like:
> 
> var
>    Var1, Var2, Var3: Integer;
>    F: TextFile; // "File" is a reserved word in Pascal
> begin
>    AssignFile(File, 'test.txt');
>    Reset(File);
>    ReadLn(File, Var1, Var2, Var3);
> 
> will work with lines like:
> 
> 10 20 30
> 100 1000 10000
> 
> but will choke on:
> 
> 10,20,30
> 100, 1000, 10000
> 
> Now, many dialects of BASIC include a facility to read comma delimited 
> input using the INPUT command, which may be what you're recalling.
> 
> > For me I'd readln then parse myself - more control and more 
> control I could
> > get like BillG :)
> > 
> > Not sure if you can cast a memorystream as a filestream
> > be nice if you could
> 
> TMemoryStream has LoadFromFile/SaveToFile methods which achieves a lot 
> of the same thing.
> 
> Stephen Posey
> [EMAIL PROTECTED]

Thanks Steven,
Long time since I use read
tend to be a real control freak and parse the whole line :)
Mick
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to