Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading a text file 1

Status
Not open for further replies.

foxnet

Programmer
Mar 24, 2005
21
US
Hi,
Does anyone see why I cannot open a list of text files for input. I keep getting an "Access denied" when trying to issue the FOPEN command.

Thanks

searchdir = alltr(thisform.txt_in.value) + "*.*"
gnumber = ADIR(gaMessages, searchdir) && Create array

for ncount = 1 to gnumber
fname = alltr(thisform.txt_in.value) + ;
alltr(gaMessages(ncount, 1))
IF FILE(fname) && Does file exist?
gnHandle = FOPEN(fname,0) && If so, open read-write
messagebox("ERROR = " + str(ferror()))
STORE FSEEK(gnHandle, 0, 2) TO gnEnd && Move pointer to EOF
if (gnEnd > 0)
gcString = FGETS(gnHandle, gnEnd) && Store contents
MessageBox(gc_String)
endif
=FCLOSE(gaMessages(ncount, 1))
ENDIF
endfor
 
=FCLOSE(gaMessages(ncount, 1))

The paramater for FCLOSE() is the handle of the file.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top