Re: Opening & Reading Text Files
- Posted by "Greg Haberek" <ghaberek at gmail.com> Dec 01, 2006
- 554 views
> What I have is: > > function ReadTextFileData(atom FileNumber) > open("file"[FileNumber]".txt", "r") What you're doing is very PHP-ish. Try this instead:
function ReadTextFileData( integer FileNumber ) sequence filename integer fn filename = sprintf( "file%d.txt", FileNumber ) fn = open( filename, "r" ) if fn = -1 then -- open failed return 0 end if -- do stuff here --return something end function