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;


|