This is probably really simple, but here's my question anyway.
I've got a tab delimited text file with three columns of data (3 letters,2 numbers,3 numbers)
I'm trying to read these in to 3 strings, then output (in a dialog box) the combined strings.
I'm getting an "Error 5: Invalid Identifier" message as soon as I run this.
Thanks.
string strOutput
proc main
string sLine
string sTemp1, sTemp2, sTemp3
if isfile "C:\test.txt"
fopen 0 "test.txt" READ TEXT ;Open our data file
while not feof 0 ;While the file still has data
fgets 0 sLine ;Read a line of data
strtok sTemp1 sLine "`t" 1 ;Get the first field
strtok sTemp2 sLine "`t" 1 ;Get the second field
strtok sTemp3 sLine "`t" 1 ;Get the third field
strcat sTemp1 " "
strcat sTemp2 " "
strinsert strOutput sTemp1 0
strinsert strOutput sTemp2 0
strinsert strOutput sTemp3 0
call test
endwhile
fclose 0
endif
endproc
proc test
dialogbox 0 8 20 264 169 2 "Caption"
pushbutton 1 45 80 164 35 "Okay" cancel
text 2 16 5 232 59 strOutput left
enddialog
endproc
I've got a tab delimited text file with three columns of data (3 letters,2 numbers,3 numbers)
I'm trying to read these in to 3 strings, then output (in a dialog box) the combined strings.
I'm getting an "Error 5: Invalid Identifier" message as soon as I run this.
Thanks.
string strOutput
proc main
string sLine
string sTemp1, sTemp2, sTemp3
if isfile "C:\test.txt"
fopen 0 "test.txt" READ TEXT ;Open our data file
while not feof 0 ;While the file still has data
fgets 0 sLine ;Read a line of data
strtok sTemp1 sLine "`t" 1 ;Get the first field
strtok sTemp2 sLine "`t" 1 ;Get the second field
strtok sTemp3 sLine "`t" 1 ;Get the third field
strcat sTemp1 " "
strcat sTemp2 " "
strinsert strOutput sTemp1 0
strinsert strOutput sTemp2 0
strinsert strOutput sTemp3 0
call test
endwhile
fclose 0
endif
endproc
proc test
dialogbox 0 8 20 264 169 2 "Caption"
pushbutton 1 45 80 164 35 "Okay" cancel
text 2 16 5 232 59 strOutput left
enddialog
endproc