Board index » delphi » Readln( file, char, char, string[10], int );

Readln( file, char, char, string[10], int );

Quote
In article <4oolhm$...@bertrand.ccs.carleton.ca> Selom Ofori wrote:

>readln( file, char, char string[10], int, int etc ) doesn't work. it will not
>read the second char from a line of text in a file. just read the second
>char as the string[10] instead. is this a bug? bp7.0 for win

There must be more to it than this because I do it all the time.
To be certain, I just tried it with BP 7.0 and BPW 7.0 for both
real and Window targets and everything worked correctly.

--
RDon...@gnn.com
http://members.gnn.com/rdonais/index.html
-------------------------------------------
Knowledge is one of the few things that you
can give away and still keep for yourself.

 

Re:Readln( file, char, char, string[10], int );


readln( file, char, char string[10], int, int etc ) doesn't work. it will not
read the second char from a line of text in a file. just read the second
char as the string[10] instead. is this a bug? bp7.0 for win

Re:Readln( file, char, char, string[10], int );


Quote
Selom Ofori wrote:

> readln( file, char, char string[10], int, int etc ) doesn't work. it will not
> read the second char from a line of text in a file. just read the second
> char as the string[10] instead. is this a bug? bp7.0 for win

I would have helped had you provided the line from the input file.  Without
that, I can only guess that your second char read might have been reading the
space separating the two characters.  To read the following line -

a b A ten char   7   14

you would have to read the first character ('a'), then the space, then the third
character ('b'), then the space, then the ten character long string ('A ten char'),
then the integer 7, then the integer 14.  A readln to accomplish this would be -

readln(ch1, SpaceChar, ch2, SpaceChar, st10, i, j);

assuming declarations as
  var
    ch1, ch2, SpaceChar : char;
    st10 : string[10];
    i, j : integer;

Hope this helps.
Bob.

Other Threads