- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was just fixing a bug in some codes and used the IFPORT routine i2=DELFILESQQ(gfile(1:ilen)) where gfile="C:\fullpath\filname.xls", the path is not long ilen is about 60 characters long. The file is not open. If the file is readonly in windows then i2=0 (no file deleted) and I call getlasterrorqq(). which returns a value of 22. The using the help and ifport the return values are !ERR$ZERO=0 ERR$NOMEM=12, ERR$ACCES=13, ERR$INVAL=22, ERR$NOENT=2.
I was expecting ERR$ACCES but get ERR$INVAL is this correct? The reason I ask is is specifically wanted to know if it was an access rights error. I am running W7 SP1 X64.
As a check if I run the same routine with the read only box unchecked on the file I get i2=1 as one would expect.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DELFILESQQ doesn't set an error status, so GETLASTERRORQQ is returning something not relevant to the DELFILESQQ operation. Note that the documentation for DELFILESQQ doesn't mention using GETLASTERRORQQ. You could try calling the Windows API routine GetLastError to see if you get something useful from that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thats not what the help file for GETLASTERRQQ says... It lists DELFILEQQ as one of its routines and lists ERR$NOMEM, ERR$ACCES, ERR$NOENT, ERR$INVAL as the error messages.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok - I looked a bit closer. DELFILESQQ uses the C unlink function, and GETLASTERRORQQ just returns the C "errno" value, so yes, those are valid choices. Why unlink is returning INVAL, I don't know. You may want to try the WIndows API DeleteFile function and see what it does.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
win api gives ERROR_ACCESS_DENIED (0x5) Access is denied. This is what is expected. I thus suspect DELFILEQQ is misinterpretting the C error codes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DELFILESQQ doesn't even look at the C error code - it just calls unlink and increments the count if it succeeds. GETLASTERROQQ simply returns errno. It could be that unlink is doing something special here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
this is not a problem DELFILESQQ is now ditched from my utilities function in favour of the win api. Looking at unlink error codes (which was basically written for unix like systems) some error codes do not translate to windows that well!

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page