Suggestion: FileWrite[Int]() return values

Started by Gilbert, Mon 15/03/2004 02:42:22

Previous topic - Next topic

Gilbert

Sorry, I may not have checked thoroughly, but seems that there aren't much error handling when writting to a file (with FileWrite() or FileWriteInt() functions).

I'm not sure but I think the game will crash if there's a read/write error when dealing with external files (like diskfull while appending to a file).

My suggestion is that the FileWrite[Int]() functions return 0 if sucessful and nonzero if there's an erroe (if it hadn't been implemented already, but nothing was written in the manual about it, so...)

It'll be good if the FileRead functions can have this kind of error handling too.

RickJ

I can second the need for error handling.  The problem with doing this for FileREad functions is that most of them already return a data value.  The FileIsEOF() function was added to be able to know when to stop reading a file.      Perhaps a FileIsError() or similar funct could be added to check for errors while reading or writing?

Pumaman

Yes, some sort of FileIsError function sounds like the best idea here, rather than returning a value from loads of different functions. I'll add it to my list.

SMF spam blocked by CleanTalk