Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » How to detect error with al_create_fs_entry()?

This thread is locked; no one can reply to it. rss feed Print
How to detect error with al_create_fs_entry()?
Arthur Kalliokoski
Second in Command
February 2005
avatar

I was trying to get the filesize of a particular file by using al_create_fs_entry() and it insisted the filesize was zero. The only error checking I'd done was to make sure the ALLEGRO_FS_ENTRY wasn't null. When I gave up to use the fseek(fp,0,SEEK_END) method, my error checking told me that the file couldn't be opened because it didn't exist (filename typo). How can this type of error be detected?

[EDIT] Forgot cookies, darn it! :-/

[EDIT2]

I just stumbled across al_fs_entry_exists(), sorry! I need to slow down.

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

― Robert A. Heinlein

SiegeLord
Member #7,827
October 2006
avatar

It's not an error, in principle, since you can use ALLEGRO_FS_ENTRY to create files. The function you're looking for is probably al_fs_entry_exists.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Arthur Kalliokoski
Second in Command
February 2005
avatar

OK, thanks Siegelord! Here's your cookie!

{"name":"Cookie.gif","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/1\/d187a2cf483dbc700e36210cd73298ee.gif","w":382,"h":380,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/1\/d187a2cf483dbc700e36210cd73298ee"}Cookie.gif

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

― Robert A. Heinlein

Go to: