meyer@unix.cis.pitt.edu (Timothy S. Meyer) (04/05/91)
A colleague of mine has a concern with a Modula-2 implementation he is using. I had no ready answer to a question--can anyone help? It seems that the compiler will not allow an assignment statement which assigns a character type to a cardinal type. But, during run-time, a character is an acceptable input when reading a cardinal. Is this the way it is supposed to be? I haven't kept up with this newsgroup--sorry if this is a repeat.
seurer+@rchland.ibm.com (Bill Seurer) (04/06/91)
No, that shouldn't be acceptable. Sounds like he is using JPI. It does really strange things if you try to enter a non-numeric character when it is reading a number. The solution is to read everything as character strings and then use the string conversion functions to convert to whatever it is you expected to read. They usually have some sort of error flag so you can detect when bad data was typed. - Bill Seurer IBM: seurer@rchland Prodigy: CNSX71A Rochester, MN Internet: seurer@rchland.vnet.ibm.com