Author Topic: Constructing floats...  (Read 8134 times)

nobody

  • Guest
Constructing floats...
« on: October 27, 2008, 11:50:30 PM »
How would I got about reading a set of integers, floats, and strings as ASCII characters from an input file?  THere is one entry per line and the first line in the file says how many entries there are.
Afterwards, we must determine what type of entry has been 'read' (int, float, or string) and depending on the type, we must create 3 different files and store each respective type on each file.  We CANNOT use fscanf to read the entries... we must use the floating point assembly instruction to help with the conversion.

My main concern is about distinguishing the kind of type being read and how to read the entries without using fscanf!  Anyone has any ideas?  I've heard it's best to read everything as floats and make the determination of each type afterward.

nobody

  • Guest
Re: Constructing floats...
« Reply #1 on: October 28, 2008, 10:21:45 AM »
> My main concern is about distinguishing
> the kind of type being read and how
> to read the entries

- open 4 files
- read line
- convert to integer -> amount of lines
- DO
- - IF "done" THEN EXIT
- - "read line"
- - IF "line has only 0...9" THEN
- - - convert as integer (???)
- - - drop into integer file
- - ELSE
- - - IF "line has only 0...9 "e" "." " THEN
- - - - convert as float (???)
- - - - drop into float file
- - - ELSE
- - - - drop into string file
- - - ENDIF
- - ENDIF
- - INC line counter
- LOOP
- CLOSE 4 files
- JMP FAR 0:0