CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  C/C++ >  C语言

c语言中的文件属性

楼主crazy_diablo(狂暴)2002-11-27 11:00:27 在 C/C++ / C语言 提问

请问,c语言中更改已经存在文件属性的函数是什么? 问题点数:100、回复次数:8Top

1 楼chenghl(程门立雪)回复于 2002-11-27 11:07:15 得分 0

SetStatus(LPCTSTR   lpszFileName,   const   CFileStatus&   status   )Top

2 楼chenghl(程门立雪)回复于 2002-11-27 11:13:38 得分 80

sorry,that's   C++;  
  to   change   file   permission,   use  
  int   _chmod(   const   char   *filename,   int   pmode   );  
  int   _wchmod(   const   wchar_t   *filename,   int   pmode   );  
   
  to   change   the   file   size,use  
  _int   _chsize(   int   handle,   long   size   );  
   
  Top

3 楼Behard(我爱天安门)回复于 2002-11-27 11:24:19 得分 20

试一试以下函数:  
  fstat  
  setftime  
   
  fblk  
   
   
      ffblk                                                               <DIR.H>  
    哌哌哌?  
  DOS   file   control   block   structure.  
   
      struct   ffblk   {  
          char   ff_reserved[21];   /*   reserved   by   DOS   */  
          char   ff_attrib;               /*   attribute   found   */  
          int     ff_ftime;                 /*   file   time   */  
          int     ff_fdate;                 /*   file   date   */  
          long   ff_fsize;                 /*   file   size   */  
          char   ff_name[13];           /*   found   file   name   */  
      };  
   
    Remarks:  
  ff_ftime   and   ff_fdate   are   16-bit   structures   divided   into   bit   fields   for  
  referring   to   the   current   date   and   time.  
   
    ff_ftime   ?5.....11?0........5?.......0?  
    苘苘苘苘   掏淹淹淹淹瓮淹淹淹淹淹瓮淹淹淹淹?  
                      韧贤贤贤贤释贤贤贤贤贤释贤贤贤贤?  
                            Hours           Minutes       Seconds/2  
   
    ff_fdate   ?5..........9?.....5?.......0?  
    苘苘苘苘   掏淹淹淹淹淹淹瓮淹淹淹瓮淹淹淹淹?  
                      韧贤贤贤贤贤贤释贤贤贤释贤贤贤贤?  
                          Years   since       Month           Day  
                                1980  
   
  The   structure   of   these   fields   was   established   by   DOS.  
   
    See   Also:  
      findfirst                     ftime   structure         find_t   structure  
   
  Top

4 楼Behard(我爱天安门)回复于 2002-11-27 11:25:29 得分 0

应该是   ffblk   吧。Top

5 楼Behard(我爱天安门)回复于 2002-11-27 11:36:29 得分 0

DOS   file   attributes  
   
      Constant     ?Description  
    屯屯屯屯屯拓屯屯屯屯屯屯屯屯屯屯?  
      FA_RDONLY   ?Read-only   attribute  
      FA_HIDDEN   ?Hidden   file  
      FA_SYSTEM   ?System   file  
      FA_LABEL     ?Volume   label  
      FA_DIREC     ?Directory  
      FA_ARCH       ?Archive  
   
  For   more   detailed   information   about   these   attributes,   refer   to   your   DOS  
  reference   manuals.  
  Top

6 楼crazy_diablo(狂暴)回复于 2002-11-27 11:46:15 得分 0

解决了,使用_chmod()这个函数  
  谢谢各位Top

7 楼Behard(我爱天安门)回复于 2002-11-27 12:02:04 得分 0

捱哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌咻  
    ?_chmod,                                                         ?           <IO.H>  
    ?_dos_getfileattr,   _dos_setfileattr   ?         <DOS.H>  
    捃苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘苘茌  
   
    Gets   or   sets   file   attributes  
   
    Declaration:  
      ?int   _chmod(const   char   *path,   int   func   [   ,   int   attrib   ]   );  
      ?int   _dos_getfileattr(const   char   *path,   unsigned   *attribp);  
      ?int   _dos_setfileattr(const   char   *path,   unsigned   attrib);  
   
    Remarks:  
  These   functions   get   and/or   set   the   DOS   file   attributes   of   the   file   given   by  
  *path:  
    ?_chmod   gets   or   sets   the   attributes  
    ?_dos_getfileattr   gets   the   attributes  
    ?_dos_setfileattr   sets   the   attributes  
   
      Argument   ?What   It   Is/Does  
    屯屯屯屯屯赝屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯?  
      path           ?Points   to   a   string   that   names   the   file   whose   attributes   are  
                        ?fetched   or   set;   *path   =   first   character   of   that   string  
      func           ?Specifies   whether   _chmod   gets   or   sets   attributes   of   the   file  
                        ?*path:  
                        ?   ?If   func   =   0,   _chmod   returns   the   current   DOS   attributes  
                        ?   ?If   func   =   1,   _chmod   sets   the   attributes   to   attrib  
      attrib       ?One   of   the   DOS   file-attribute   symbolic   constants   defined  
                        ?in   DOS.H.  
      attribp     ?Points   to   location   where   _dos_getfileattr   stores   attributes  
   
    Return   Value:  
      ?On   success,  
            ?_chmod   returns   file   attribute   word  
    ?_dos_getfileattr   and   _dos_setfileattr   return   0  
  ?On   error,  
    ?_chmod   returns   -1   and   sets   errno   to   one   of   the   following:  
    ENOENT     (Path   or   file   name   not   found)  
    EACCES     (Permission   denied)  
    ?_dos_getfileattr   returns   the   DOS   error   code   and   sets   errno   to  
    ENOENT   or   EACCES  
    ?_dos_setfileattr   returns   the   DOS   error   code   and   sets   errno   to  
    ENOENT  
   
    Portability:  
    ?DOS   ?UNIX   ?Windows   ?ANSI   C   ?C++   Only   ?  
    ?Yes   ?           ?     Yes       ?               ?                   ?  
    韧屯屯贤屯屯拖屯屯屯屯拖屯屯屯屯贤屯屯屯屯图  
    See   Also:  
  chmod         _creat       stat  
   
    Examples:  
  _chmod   example                           _dos_getfileattr   example  
  _dos_setfileattr   example  
  FA_RDONLY   //?Read-only   attribute  
  FA_HIDDEN   //?Hidden   file  
  FA_SYSTEM   //?System   file  
  FA_LABEL     //?Volume   label  
  FA_DIREC     //?Directory  
  FA_ARCH       //?Archive  
   
  Top

8 楼Behard(我爱天安门)回复于 2002-11-27 12:27:32 得分 0

要给分呀!Top

相关问题

  • c语言文件属性问题!急!高分
  • c语言中用什么函数更改已经存在文件属性!
  • C语言文件操作
  • c/c++语言读取.rgb文件
  • 关于c语言与c++语言的头文件
  • C语言头文件一题
  • c语言中头文件的问题
  • C语言中新建文件
  • c语言头文件问题
  • 怎样用C语言编.dll文件?

关键词

  • c++
  • 屯屯屯屯屯屯
  • 淹淹
  • 贤贤
  • getfileattr
  • setfileattr
  • fdate
  • ftime
  • attrib
  • attributes

得分解答快速导航

  • 帖主:crazy_diablo
  • chenghl
  • Behard

相关链接

  • C/C++ Blog
  • C/C++类图书
  • C/C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo