Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with input and print

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How come when I input a record from a file, for example:

1,0,234127805,1,2,TWO-TIMERS,12 ELM,GENOA,WI,32145,01248.00,025.00,041392

Using the statement:

INPUT #1, MRC, MTOR, MCN, MR, MD, MCOMPN$, MCOMPA$, MC$, MS$, MZC, MTYTD, MIB, MLS

MCN, the third number, comes out 2.341278E+08 ? So when I try printing it using #########, it comes out 234127808? How do I stop this from happening?
 
Hi,

A quick and dirty way would be to save it as a string, and when reading it back convert it back to a number e.g.

Print #1,MTR,MTOR,STR$(MCN),......... When saving

Input #1,MTR,MTOR,MCNXX$,...........
MCN=VAL(MCNXX$) When loading
Any Help, Yes/No let me know

Regards

________________________________________
Is not a fool a wise man in his own eyes - Proverbs
 
2.341278E+08 is the computer's representation of your number, scienfic notation. To display the entire number you would need to make it a string but I think as far as calculations are concerned 2.341278E+08 will be the number used as it looks like you are limited to 7 significant digits.

Hopefully that explains the problem.

JavaDude32
 
You can also try using the pound sign to save/retrive the double floating number. Such as MCN# instead of:

Get as STR$(MCN), then
conver to VAL for calculations or to modify, then
convert to STR$ for saving to file.

It all depends on how much typing you want to do.

--MiggyD It's better to have two heads to solve a problem from different angles than to have tunnel vision to a dead end.
 
I have given up using INPUT and PRINT with files. I would use GET and PUT, it is much easier to use, this is what I use for all of my programs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top