Functions | |
char * | qfits_get_dir_name (const char *filename) |
Find the directory name in the given string. | |
char * | qfits_get_base_name (const char *filename) |
Find out the base name of a file (i.e. without prefix path). | |
char * | qfits_get_root_name (const char *filename) |
Find out the root part of a basename (name without extension). | |
char * | qfits_get_ext_name (const char *filename) |
Find out the extension of a file name. |
Example:
char * s ; s = qfits_get_dir_name("/mnt/cdrom/data/image.fits")
s contains now "/mnt/cdrom/data" but will loose these contents at the next function call. To retain its value, you can either do:
char s[1024]; strcpy(s, qfits_get_dir_name("/mnt/cdrom/data/image.fits"));
or:
char * s; s = strdup(qfits_get_dir_name("/mnt/cdrom/data/image.fits")); ... free(s);
|
Find out the base name of a file (i.e. without prefix path).
This function does not check for the existence of the path or the file. Examples: qfits_get_base_name("/cdrom/data/image.fits") returns "image.fits" qfits_get_base_name("filename.fits") returns "filename.fits" |
|
Find the directory name in the given string.
This function does not check for the existence of the path or the file. Examples: qfits_get_dir_name("/cdrom/data/image.fits") returns "/cdrom/data" qfits_get_dir_name("filename.fits") returns "." |
|
Find out the extension of a file name.
qfits_get_base_name ).Works with all kinds of extensions: returns the part of the string after the last dot. If no dot is found in the input string, NULL is returned. Examples: qfits_get_ext_name("filename.fits") returns "fits" qfits_get_ext_name("hello.c") returns "c" qfits_get_ext_name("readme") returns NULL |
|
Find out the root part of a basename (name without extension).
This function does not check for the existence of the path or the file. Examples: qfits_get_root_name("/cdrom/filename.fits") returns "/cdrom/filename" qfits_get_root_name("filename.paf") returns "filename" qfits_get_root_name("filename") returns "filename" qfits_get_root_name("filename.ext") returns "filename.ext" Since the returned string is statically allocated in this module, do not try to free it or modify its contents. |