Post Reply 
libhpcalcs: portable (Windows / MacOS X / Linux) connectivity kit library
12-24-2013, 03:48 PM (This post was last modified: 12-24-2013 03:58 PM by debrouxl.)
Post: #36
RE: libhpcalcs: portable (Windows / MacOS X / Linux) connectivity kit library
Thanks Smile
An access fault in strrchr means that its argument points to nowhere sane... which, in turn, means that basename returned something unexpected to me, possibly NULL.
Under Linux, `man basename` shows no relevant way for dirname() and basename() to return NULL, so I didn't bother adding a check. What does `man basename` say on MacOS X ?

Also, for testing purposes, try replacing
Code:
char * file = basename(filepath);
char * extension = strrchr(file, '.');
by something along the lines of
Code:
char * duplicated = strdup(filepath);
char * file = basename(duplicated);
char * extension = strrchr(file, '.');
free(duplicated);
(I'm going to do something pretty much that, with more error checking, for portability purposes)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: libhpcalcs: portable (Windows / MacOS X / Linux) connectivity kit library - debrouxl - 12-24-2013 03:48 PM



User(s) browsing this thread: 5 Guest(s)