FILENAME.C
资源名称:ertos.rar [点击查看]
上传用户:sunrenlu
上传日期:2022-06-13
资源大小:1419k
文件大小:3k
源码类别:
操作系统开发
开发平台:
DOS
- #include <string.h>
- #include <io.h>
- #include <stdio.h>
- #include <rtos.h>
- #include <filename.h>
- #if defined(__DJGPP__)
- #include <unistd.h>
- #endif
- //----------------------------------------------------------------------
- // FileGetPath - copies a file's path (but not file name) to a new location
- void FileGetPath( char *filename, char *buffer )
- {
- char *p;
- strcpy( buffer, filename );
- /* look for last , the one preceding the filename */
- if ( (p = strrchr(buffer,'\' )) == NULL ) {
- if ( buffer[1] == ':' ) p = buffer + 2;
- else p = buffer;
- }
- *p = 0;
- }
- //----------------------------------------------------------------------
- // FileGetName - copies a file's name (discarding path) and ext to new location
- void FileGetName( char *filename, char *buffer )
- {
- int len;
- /* start by finding length of the path */
- FileGetPath( filename, buffer );
- len = strlen( buffer );
- /* and note that '' must be skipped */
- if ( filename[ len ] == '\' ) len++;
- strcpy( buffer, filename + len );
- }
- //----------------------------------------------------------------------
- // FileGetExt - returns pointer to extension within this filename
- // - if no extension, returns pointer to "