File commands extended
Posted: Wed Jun 08, 2005 9:11 pm
I would like to suggest that the File commands be extended to use a
#File parameter, such as
which would replace
This is a lot more intuitive, I believe. Now it is too easy to forget that the
"current file" has changed and that leads to bugs. Spent most of the
morning tracking down that exact situation.
I realize this change would break existing code, but perhaps this could
be included in the upcoming Vs 4.0.
Many of the File commands need this change. This change would
is more consistent and easier for me to understand than
especially when the manipulation portions of the code are many lines
and/or procedures separated.
Thanks,
Terry
#File parameter, such as
Code: Select all
WriteData(#File, *MemoryBuffer, LengthToWrite)
Code: Select all
UseFile(#File)
WriteData(*MemoryBuffer, LengthToWrite)
"current file" has changed and that leads to bugs. Spent most of the
morning tracking down that exact situation.
I realize this change would break existing code, but perhaps this could
be included in the upcoming Vs 4.0.
Many of the File commands need this change. This change would
- make them consistent with the ones that already require the #File parameter
deprecate the need for the UseFile(#File) command
Code: Select all
; psuedo code
OpenFile(10,"Example.txt")
OpenFile(20,"Insert.txt")
OpenFile(30,"Rewrite.txt")
While Eof(10) = 0
Text$ = ReadString(10)
; manipulate the data to your heart's content
WriteStringN(30,Text$)
Text$ = ReadString(20)
; manipulate the data to your heart's content
WriteStringN(30,Text$)
Wend
CloseFile(10)
CloseFile(20)
CloseFile(30)
Code: Select all
; psuedo code
OpenFile(10,"Example.txt")
OpenFile(20,"Insert.txt")
OpenFile(30,"Rewrite.txt")
While Eof(10) = 0
UseFile(10)
Text$ = ReadString()
; manipulate the data to your heart's content
UseFile(30)
WriteStringN(Text$)
UseFile(20)
Text$ = ReadString()
; manipulate the data to your heart's content
UseFile(30)
WriteStringN(Text$)
Wend
CloseFile(10)
CloseFile(20)
CloseFile(30)
and/or procedures separated.
Thanks,
Terry