Jump to content
Excelsior Forums
Sign in to follow this  
kaztkc

A problem of ReadChar(ArgChan(), ch)

Recommended Posts

TextIO.ReadChar(ArgChan(), ch) behaves differently from e.g. TextIO.ReadChar(StdInChan(), ch). That is, it ignores spaces, so that calling it repeatedly, you will get allthewordswithoutonesinglespace. Compile this code in Win version

MODULE Test;

FROM TextIO IMPORT ReadChar, WriteChar;

FROM ProgramArgs IMPORT ArgChan, IsArgPresent;

FROM StdChans IMPORT StdOutChan;

? VAR

? ? ?ch: CHAR;

BEGIN

? WHILE IsArgPresent() DO

? ? ?ReadChar(ArgChan(), ch);

? ? ?WriteChar(StdOutChan(), ch) END END Test.

and type

? test all the words without one single space,

you will see. I feel it somewhat inconvenient, esp. when I need precise control such as discerning plain strings and quoted ones.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×