number FGets(string buffer, number max, number handle)

Reads a string from the file pointed to by handle and stores it in buffer. If the string's length is greater than max, only max bytes are read.

It returns the number of bytes read.

(var hFile, buffer[41])

// Open the file and write to it
(if( <> NULL (= hFile FOpen("somefile.txt" fCREATE)) )
    FPuts(hFile "Hello World!")

// Open the file, read it's first string, and print it to the screen
(if( <> NULL (= hFile FOpen("somefile.txt" fOPENFAIL)) )
    FGets(buffer 40 hFile)


See Also: FOpen, FClose, FPuts