通配符的 C 语言源代码
/* find files from wildcards, for MicroSoft C v4.0 */
/* ------------------------------------------------------------ */
/* copyright 1986: */
/* Nourse Gregg & Browne, Inc. */
/* 1 Horizon Road. #612 */
/* Fort Lee, NJ 07024 */
/* */
/* ------------------------------------------------------------ */
/* ----------------------------------------------------------------------*
This pair of routines will do a wildcard search
you must call dfirst() once to supply the search pattern
and get back the first file that matches that pattern.
then, call dnext() to get the next file in the list.
both dfirst() and dnext() return zero if a file has been found,
non-zero otherwise.
The calling parameters are as follows:
dfirst(pattern,attr,file_name,file_date,file_time,file_size);
dnext(file_name,file_date,file_time,file_size);
Where:
char *pattern; (wild card pattern. eg. "*.c" )
int attr; (the file attribute qualifier )
char *file_name; (output: the name of found file (13 bytes min.) )
int *file_date; (output: the file's date (directory format) )
int *file_time; (output: the file's time )
long *file_size; (output: the file's size in bytes )
*----------------------------------------------------------------- */
#include <dos.h>
#include <stdlib.h>
#define SET_DTA 0x1A
#define GET_DTA 0x2F
#define FIND_FIRST 0x4E
#define FIND_NEXT 0x4F
struct dta_struct {
char dummy[21];
char attr;
int time;
int date;
int low_size;
int hi_size;
char name[13];
char dummy2[14];
};
static struct dta_struct dta;
dfirst (fmask,fattr,fname,fdate,fti
相关文档:
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
/****************************************************
* 函数功能: 判断参数路径是否为(正确的)目录
* 函数返回: 0为表示路径为文件,1为非目录.其他为错误
* 参数: path文件需要判断的目录的路径.
*  ......
1//由于使用gcc编译,所以编译时要链接上c++的库,命令是gcc -lstdc++ main.cpp -o main
//本文小程序实现的是对/home/1.avi大小的计算。很简单,贴出来只是为了方便不知道的朋友
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <sys/stat.h>
5 #includ ......
曾经碰到过让你迷惑不解、类似于int * (* (*fp1) (int) )
[10];这样的变量声明吗?本文将由易到难,一步一步教会你如何理解这种复杂的C/C++声明:我们
将从每天都能碰到的较简单的声明入手,然后逐步加入const修饰
符和typedef,还有函数指针,最后介绍一个能够让你准确地理解任何C/C++ ......