0
votes

How do i read in pascal a string and an integer in the same line like the C's scanf("%s %d", str, &n); version?

3

3 Answers

1
votes

I am sorry, but I am pretty sure there is no way. You must read them separated.

1
votes

Pascal does not have an equivilent of C's ...scanf() functions. You will have to either find a third-party implementation, write your own implementation, or just parse the string directly.

0
votes

If from stdin:

  read(s); read(i);

If not, then you are out of luck for Borland's Pascal variants. Free Pascal (2.4+) inherited a variant from Apple(Standard Pascal derivative) variants that takes input from a string:

 readstr(inputstr,s,i); 

IIRC this is an Extended Pascal standard procedure that is commonly implemented by standard Pascal variants too, since it is basically a variant of the standard Pascal readln from input.