BBS: Inland Empire Archive Date: 04-17-92 (16:21) Number: 62 From: JEAN CREPEAU Refer#: NONE To: KEITH WATKINS Recvd: NO Subj: Binary Files Conf: (2) Quik_Bas
In a message to ALL, KEITH WATKINS wrote:
KW=> I am trying to use binary for the first time. I run this program and
it appears to update ok until it hits the PUT #1 , , PRICE1$. When it
hits that it blows up. Can any one see what I am doing wrong here.
Thanks! -Keith
When you PUT #1,,string, QuickBASIC write only the characters in
the string. If you plan to used variable-lenght strings, you must also
write the lenght of the string. Use the following sentences:
TEMP$=MKI$(LEN(string))+string:PUT #1,,TEMP$
or
TEMP%=LEN(string):PUT #1,,TEMP%:PUT #1,,string
These two lines will save the lenght of the string and then all the
characters in the string.
string=INPUT$(CVI(INPUT$(2,filenum)),filenum)
This will read the string back into a string variable.
Jean
---
* Origin: INTERACESS Montreal (QC) Canada (514) 528-1415 (1:167/280)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET