Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Borland > Re: reading var...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 7 Topic 1019 of 1118
Post > Topic >>

Re: reading variables from string similar to C function sscanf

by nils.toenissen@[EMAIL PROTECTED] Apr 6, 2007 at 03:23 PM

On 6 Apr., 22:29, "winston19842...@[EMAIL PROTECTED]
"
<winston19842...@[EMAIL PROTECTED]
> wrote:
> On Apr 6, 3:58 pm, nils.toenis...@[EMAIL PROTECTED]
 wrote:
>
> > Hello everybody,
>
> > beeing new to delphi / pascal i am searching a possibility to read
> > variables from a string just the same way you use readln to read
> > variables from a textfile - equivalent to the C function sscanf.
>
> > I want to extract data from a textfile. When a certain word is found
> > a the beginning of the current line then  i want to read the following
> > data (three double variables) in the line into variables.
>
> What is the format of the data?
> How would you write it in C?
> There is no built-in equivalent to sscanf in Pascal. Technically, C
> doesn't have a built-in function either. sscanf is part of a library.
> Delphi probably has such a function in a library somewhere - I don't
> know Delphi.
>
> I'd do a look where I look for the location of the "trigger" word
> starting at position 1 of the record. Then the reading of the three
> doubles depends on how they are represented in the record.


The file format is an ASCII file with different data. I am searching
for line that start wirth the word GRID. The format of the lines is
for example

....
GRID 23.5 57.3 28.7
....

So i am going through the file with the readln command

....
f:TextFile;
line : string;
....
while not EOF (f) do
begin
   if (AnsiStartsText('GRID',line) then

end;
 




 7 Posts in Topic:
reading variables from string similar to C function sscanf
nils.toenissen@[EMAIL PRO  2007-04-06 12:58:42 
Re: reading variables from string similar to C function sscanf
"winston19842005@[EM  2007-04-06 13:29:34 
Re: reading variables from string similar to C function sscanf
nils.toenissen@[EMAIL PRO  2007-04-06 15:23:25 
Re: reading variables from string similar to C function sscanf
nils.toenissen@[EMAIL PRO  2007-04-06 15:29:52 
Re: reading variables from string similar to C function sscanf
"Jason Burgon"   2007-04-07 10:51:21 
Re: reading variables from string similar to C function sscanf
"winston19842005@[EM  2007-04-06 18:08:32 
Re: reading variables from string similar to C function sscanf
"Heinrich Wolf"  2007-04-07 07:25:51 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 18:41:04 CDT 2008.