Hi TheOne,
Add 1
If you handle two different files, you need to store two different handles:
Dim FileHandleA, FileHandleB As DWord
FileHandleA = FILE_Open (FileNameA, "OUTPUT")
FileHandleB = FILE_Open (FileNameB, "INPUT")
Note - you can also load whole file at once to string:
DIM sFileContent AS STRING
sFileContent = File_Load("c:\test.txt")
Or retrieve individual lines to string array directly:
DIM sLines() AS STRING
DIM nLines AS LONG = PARSE( FILE "c:\test.txt", sLines, $CRLF)
... and write whole file from string:
DIM sFileContent AS STRING
sFileContent = "My text for file, line 1" + $CRLF + "Line 2"
File_Save("c:\test.txt", sFileContent)
Add 2
Your:
If x = 2 or 3 or 4 or 99 or 101 or 200 or 500 or 1000 then ...
is valid for numeric expressions, but it actually evaluates the part after = as expression.
What you need here is:
if x = 2 or x = 3 or x = 4 or x = 99 or x = 101 or x = 200 or x = 500 or x = 1000 then
or more straightforward test:
if In(x, 2, 3, 4, 99, 101, 200, 500, 1000) then
The In works just for numeric cases.
For string cases, if you test for 51 states which you have in array, I would do:
stateFound = false
for i = 1 to UBound(aStates) ' -- = from 1 to upper bound of aStates array, which is 51
if state = aStates(i) then
stateFound = true
exit for
end if
NEXT
if stateFound then
' -- Do something
end if
Petr
Bookmarks