Sunday, September 26, 2010

Some C helper routines...

I wrote a small application for counting the number of lines (of code) in *.c files today.
As a side effect i have now some handy functions for different applications.
Luckily i had the passion to write them.

Lets take a look at the functions:
void findFiles( char *, void (char *, char *) );
Finds all files in a given folder + subfolders and calls a user defined callback function.

const char *getFileType( char * );
Returns the file extension of a given file.

const char *right( char *, int );
Returns 'i'  chars from the right side of an string (same function as the command 'right' in VBS).

Works with PellesC 6.00.4.
I used some non standard C functions in the code. So it will not work with every compiler without modifications.

Here is the library:

(God damn...! The layout on is so crapy)