通配符的 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
相关文档:
字符数组和字符串
&字符数组和字符串的概念 &字符数组的初始化
&字符串的输入输出 &综合举例
字符数组和字符串的概念
字符数组是元素类型为字符的数组 ,它既具有普通数组的一般性质 ,又具有某些特殊性质。
& ......
1.求下面函数的返回值(微软)
int func(x)
{
int countx = 0;
while(x)
{
countx ++;
x = x&(x-1);
}
return countx;
}
假定x = 9999。 答案:8
思路:将x转化为2进制,看含有的1的个数。
2. 什么是“引用”?申明和使用“引用”要注意哪些问题?
答:引用就是某个目标变量的&ldquo ......
曾经碰到过让你迷惑不解、类似于int * (* (*fp1) (int) )
[10];这样的变量声明吗?本文将由易到难,一步一步教会你如何理解这种复杂的C/C++声明:我们
将从每天都能碰到的较简单的声明入手,然后逐步加入const修饰
符和typedef,还有函数指针,最后介绍一个能够让你准确地理解任何C/C++ ......
1 #i nclude “filename.h”和#i nclude <filename.h>的区别?
答:对于#i nclude <filename.h>编译器从标准库开始搜索filename.h
对于#i nclude “filename.h”编译器从用户工作路径开始搜索filename.h
2 头文件的作用是什么?
答:一 ......
stroul,
strdup
snprintf()
atio
C中常用字符串操作函数
#include <string.h>
size_t strlen(const char *s) 测量字符串长度s的实际长度。
例如s[20]="abc",那么strlen(s)的结果是3,而不是20.这就是实际长度
char *strcat(const char *s1, const *s2) ......