@Atheist:
I will try to answer all your questions in the correct order.
Concerning all variant you mentionned for "Open To Read" command, yes, all should be possible .. it's the compiler that will parse correct data to input them in the command "Open To Read".
Concerning file existence, it will be coded in something this way :
If File Exist( FILENAME$ ) = 1 Then ....
Structure is really important.
You have 2 cases :
1. Commands : use arguments (or not) but return nothing. Generall coded this way :
COMMAND NAME argument1 [, argument2, argument3, etc ... ]
or :
COMMAND NAME
(simply if no argument is needed)
2. Functions : use arguments (or not) and return something, generally coded this way :
RETURNVALUE = FUNCTION NAME( argument1 [, argument2, argument3, etc ... ])
Or :
RETURNVALUE = FUNCTION NAME()
(simply if no argument is needed)
It's important to keep this structure to always know if a command/function return a value or not and to use if correctly.
The channel is really important because it allow you to open simultaneously more than 1 files. With this, you can read the next component on the correct file you had opened sooner, even if more than one file is opened.
FILEDATA$= Str$(2, CHANNEL)
no. it's not enough "easy to understand" and not intuitive.
READ STRING mean what it mean "you read a string"
if you want to read 2 bytes and make them become a string, you should combine this way :
FILEDATA$ = Str$( Read Word( CHANNEL ) )
Read Word( CHANNEL ) will return a 2 bytes value readen from the file and Str$() will transforme these 2 butes into a string.
Quote:
Hmmm, I think the channel number should always be first, even up above.
Isn't it exactly what I mentionned in my previous post ?
Quote:
Write CHANNEL, VARIABLE, 2
That could be a 2 byte integer variable.
Write CHANNEL, WORDTOWRITE#, 4
A 4 byte real number.
It's not possible and too hasardous to allow this. It should also result in a performance cost for checkings ...
when you code your program, you must work in a structured way, it's better ... and using the correct data type for the needed job result in higher performance (it avoir the compiler to have to cast data from a format to another).
using the correct command for the correct data type.
If you don't use the correct data type for the correct command, the compiler will try to cast your data to the correct format but the compiler can't cast STRING to other format nor other format to STRING.
I think I've answered all your questions.