diff options
Diffstat (limited to 'flat.c')
-rw-r--r-- | flat.c | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -51,3 +51,34 @@ cSkinDisplayTracks *cFlat::DisplayTracks(const char *Title, int NumTracks, const cSkinDisplayMessage *cFlat::DisplayMessage(void) { return new cFlatDisplayMessage; } + + +char * substr(char * string, int start, int end) +{ + char * p = &string[start]; + char * buf = (char*) malloc(strlen(p) + 1); + char * ptr = buf; + if(!buf) return NULL; + + while(*p != '\0' && start < end) { + *ptr ++ = *p++; + start ++; + } + *ptr++ = '\0'; + + return buf; +} + +char *GetFilenameWithoutext(char * fullfilename) +{ + int i, size; + i = size = 0; + + while(fullfilename[i] != '\0') { + if(fullfilename[i] == '.') { + size = i; + } + i++; + } + return substr(fullfilename, 0, size); +} |