Re: Opening & Reading Text Files

new topic     » goto parent     » topic index » view thread      » older message » newer message

> 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


new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu