EDN首页   博客首页

日志档案

发表于 2008-7-3 20:07:56

1

标签: 无标签

linux下面编程的几个数据结构

1、获取磁盘信息

                              struct   statfs   {  
                                    long         f_type;           /*   type   of   filesystem   (see   below)   */  
                                    long         f_bsize;         /*   optimal   transfer   block   size   */  
                                    long         f_blocks;       /*   total   data   blocks   in   file   system   */  
                                    long         f_bfree;         /*   free   blocks   in   fs   */  
                                    long         f_bavail;       /*   free   blocks   avail   to   non-superuser   */  
                                    long         f_files;         /*   total   file   nodes   in   file   system   */  
                                    long         f_ffree;         /*   free   file   nodes   in   fs   */  
                                    fsid_t     f_fsid;           /*   file   system   id   */  
                                    long         f_namelen;     /*   maximum   length   of   filenames   */  
                              };  
   
  f_bfree   *   f_bsize   应该就是剩余空间

2、获得终端信息的

termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow, cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed - 获取和设置终端属性,行控制,获取和设置波特率

 

它是指向一个 termios 结构的指针。这个结构包含了至少下列成员:


tcflag_t c_iflag;      /* 输入模式 */
tcflag_t c_oflag;      /* 输出模式 */
tcflag_t c_cflag;      /* 控制模式 */
tcflag_t c_lflag;      /* 本地模式 */
cc_t c_cc[NCCS];       /* 控制字符 */

系统分类: 自由话题   |   用户分类: 无分类   |   来源: 整理   |   【推荐给朋友】   |   【添加到收藏夹】

    阅读(219)    回复(0)  

投一票您将和博主都有获奖机会!