99问答网
所有问题
怎样使用c语言 dir.h 里的函数 获得文件大小
我是菜鸟 请举个获得 c:\\boot.ini 大小的例子
我用tc vc莫答
举报该问题
其他回答
第1个回答 2009-01-23
fseek(hFile,0,SEEK_END);
len = ftell(hFile);
策略:
1.用fopen打开该文件。
2.将文件指针移动到末尾。
3.调用ftell得到的就是文件的长度。单位bytes.
第2个回答 2009-01-23
CFileStatus status;
CFile::GetStatus("c:\\boot.ini",status);
long lSizeOfFile;
lSizeOfFile = status.m_size;
lSizeOfFile的值就是c:\\boot.ini 文件的大小
相似回答
C语言
中的include<
dir.h
>中的相关
函数
和作用
答:
fnmerge()建立
文件
路径
函数
原形:void fnmerge(char *path,const char *drive,const char *dir, const char *name,const char *ext)功能:合成drive:\dir\name.ext,放在path 头文件:
dir.h
fnsplit()分解完整的路径名函数 原形:int fnsplit(char *path,const char *drive,const char *dir,c...
编写程序,输出指定
文件夹
下
的文件
和文件夹的数量,文件要给出文件的...
答:
using namespace std;void listFiles(const WCHAR *
dir
);int main(){ ios::sync_with_stdio(false);//mingW gcc setlocale(LC_CTYPE,"");//mingW gcc WCHAR dir[]=L"f:/sd/*.*";listFiles(dir);return 0;} void listFiles(const WCHAR * dir){ HANDLE
h
Find;WIN32_FIND_DATA findData;...
监控磁盘
大小c语言
答:
if (INVALID_HANDLE_VALUE !=
hFile
){ do { // 过滤掉当前目录"." 和上一层目录".."if ('.' == FileData.
cFile
Name[0])continue;// 拼接
文件
路径 wsprintf(pTempSrc, "%s\\%s", pszDirectory, FileData.cFileName);// 判断是否是目录还是文件 if (FileData.dwFileAttributes &
FILE
_...
我需要
c语言
每个头
文件里的
所有
函数
介绍及
用法
!
答:
(一) 像素
函数
56. putpixel() 画像素点函数功能: 函数putpixel() 在图形模式下屏幕上画一个像素点。
用法
: 函数调用方式为void putpixel(int x,int y,int color);说明: 参数x,y为像素点的坐标,color是该像素点的颜色,它可以是颜色符号名,也可以是整型色彩值。 此函数相应的头
文件
是graphics.
h
返回值: 无例...
C语言
:求头
文件dir.h
答:
define
FILE
NAME 0x04 define DIRECTORY 0x08 define DRIVE 0x10 define MAXPATH 80 define MAXDRIVE 3 define MAX
DIR
66 define MAXFILE 9 define MAXEXT 5 int _Cdecl c
hdir
(const char *path);int _Cdecl findfirst (const...
c语言
常用
函数
有哪些?主要掌握的要点是什么
答:
头
文件
:stdlib.h、calloc.
h函数
11。ceil()原形∶double ceil(double num)功能∶求不小于num的最小双精度整数头文件∶math.h函数12。
c
gets()读字符串函数原形:char *cgets(char *str)功能:从控制台读入一个字符串,并将该字符串(和字符串长度)存入有str所指向的地址中。注意:在调用cgets之前,必须将要读入的...
C语言
:求头
文件dir.h
答:
define MAX
DIR
66 define MAX
FILE
9 define MAXEXT 5 int _Cdecl c
hdir
(const char *path);int _Cdecl findfirst (const char *path, struct ffblk *ffblk,int attrib);int _Cdecl findnext (struct ffblk *ffblk);void _Cdecl fnmerge (char *path,const ...
linux下
C语言怎么
统计某个目录下
的文件
个数
答:
include <dirent.
h
> include <errno.h> include <string.h> define MAX 1024 int get_
file
_count(char *root){
DIR
*
dir
;struct dirent * ptr;int total = 0;char path[MAX];dir = opendir(root); /* 打开目录*/ if(dir == NULL){ perror("fail to open dir");exit(1);} errno ...
怎样使用C语言
列出某个目录下
的文件
?
答:
C语言本身没有提供象
dir
_list()这样
的函数
来列出某个目录下所有的
文件
。不过,
利用C语言
的几个目录函数,你可以自己编写一个dir_list()函数。首先,头文件dos.
h
定义了一个find_t结构,它可以描述DOS下的文件信息,包括文件名、时间、日期、
大小
和属性。其次,C编译程序库中有_dos_findfirst()和_dos...
大家正在搜
c语言file函数使用
c语言文件读写函数
c语言fopen函数的用法
C语言文件函数
c语言调用函数
c语言函数大全
c语言怎么读取文件
c语言system函数用法
c语言函数