Character Assign/Read to Cardinal 
Author Message
 Character Assign/Read to Cardinal

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.

Tue, 21 Sep 1993 10:01:02 GMT  
 Character Assign/Read to Cardinal
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.

Wed, 22 Sep 1993 01:08:43 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Assigning a new character to a key

2. Assigning a number string to a character variable

3. Reading/Assigning to internal signals

4. wire assign vs continous assign

5. assigning to None vs. assigning to as

6. Reading one character at a time?

7. error reading russian characters from disk

8. Reading characters from screen

9. reading a single character

10. Search a spreadsheet for a character string (date) and read to another date

11. Reading Text files with extended ASCII characters

12. reading characters without waiting for carriage return


Powered by phpBB® Forum Software