Items tagged with fopen

Feed

Maple help pages are terrible.  Sorry, but this is true.

I am looking for one example of how one is supposed to open a file and correctly check that the open was successful and no error occured, all done in code. As in a script.

All what help in fopen says is that if this and that, it generates an error.

            "

OK. But to check for this in code? Why not show an example? the help page on iostatus just lists possible errors. Again, not a SINGLE example of actual Maple code showing how to actually check or handle an error. It just says to call iostatus() and shows the output without an example of what to do next and what to check for.

Lets say one does this:


fileName := "C:\\foo.txt";
fd       := fopen(fileName,WRITE):

Now what? How to check the above was successful? Do I need a trap and catch? catch what? Do I need to check for fd being greater or equal to zero and also use trap in addition? And if an error happens, how to know what it is? How to to format the message, etc.. all in CODE (not interactive) and not by saying just look at the screen and see if there is an error message.

Spend 30 minutes in the help pages and could not find ONE example that shows how to actually check for errors.

I have no idea who writes Maple helps pages, but I find the help pages useless most of the time.

Compare the help for linux fopen for example, where is gives exact details of how to handle the error and find the exact error, all in code.

 

The command

fd:=fopen("C:/temp/",'WRITE');

suddenly does not work. I keep getting a 'permission denied' error message. I haven't had to write anything to a file for a while so do you think the recent windows update screwed something up? In fact, I can't seem to write any file anywhere. It was working weeks ago. My apology if this ends up being a lame question. :)

 

Page 1 of 1