You are not logged in.
Pages: 1
ok, anyone here with experience using glob? On occasion it returns -1, which isn't a defined return code, so I have no clue where this comes from... adding an errofunc doesn't help...
Offline
I have no clue, but I found this..
If glob succeeds, it returns 0. Otherwise, it returns one of these error codes:
GLOB_ABORTED
There was an error opening a directory, and you used the flag GLOB_ERR or your specified errfunc returned a nonzero value. for an explanation of the GLOB_ERR flag and errfunc.
GLOB_NOMATCH
The pattern didn't match any existing files. If you use the GLOB_NOCHECK flag, then you never get this error code, because that flag tells glob to pretend that the pattern matched at least one file.
GLOB_NOSPACE
It was impossible to allocate memory to hold the result.
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
yeah, from the header:
/* Error returns from `glob'. */
#define GLOB_NOSPACE 1 /* Ran out of memory. */
#define GLOB_ABORTED 2 /* Read error. */
#define GLOB_NOMATCH 3 /* No matches found. */
#define GLOB_NOSYS 4 /* Not implemented. */
... but no "-1" that's why I'm so confused.... I understand it failed, but there's no indication as to why...
Offline
Try checking errno...
Offline
Try checking errno...
yeah, I looked through it... if the error returned is not from one of those specified, it's from one of the underlying opendir/readdir/closedir calls... makes sense...
Offline
Pages: 1