Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Linux²é¿´Ó²ÅÌ´óС£¬ÓÃC/C++³ÌÐòд¡£

¸÷룬ÎÒÓÐÈçÏ´úÂ룺
struct statfs diskStatfs;
statfs("/", &diskStatfs);

long iTotalCapacity = diskStatfs.f_blocks * (diskStatfs.f_bsize / £¨1024 * 1024)£©; (Mb)
long iFreeCapacity = diskStatfs.f_bfree * (diskStatfs.f_bsize / £¨1024 * 1024)£©; (Mb)

ÎÒÏë»ñµÃϵͳµÄÕû¸öÓ²ÅÌ´óСÒÔ¼°Ê£ÓàµÄÓ²ÅÌ´óС£¬¿ÉÊä³öµÄ½á¹û¶¼ÊÇ0¡£ÊDz»ÊÇÔ½½çÁË£¬Èç¹ûÊǸÃÔõô¸Ä½ø£¿
»òÕßÓÐûÓиüºÃµÄ·½·¨¡£

Çë¸ßÊÖÖ¸½Ì£¬Ð»Ð»¡£
system("fdisk -l");

ʹÓÃϵͳÌṩµÄshellÃüÁºÇºÇ...

Â¥ÉÏÄÜ·ñ˵µÄÏêϸµã£¬Ð»Ð»¡£
Èç¹ûÓÃsystem("fdisk -l"); ÎÒÔõÑùµÃµ½½á¹û£¿


ҪôÄã¾ÍÓø¡µãÊý¡£
ÕûÊý³ý·¨¾ÍÊÇÕâÑù£¬Ð¡µÄ³ý´óµÄ£¬½á¹û¾ÍÊÇ0¡£

long iTotalCapacity = diskStatfs.f_blocks * diskStatfs.f_bsize / (double)£¨1024 * 1024); (Mb)
long iFreeCapacity = diskStatfs.f_bfree * diskStatfs.f_bsize / (double)£¨1024 * 1024); (Mb)

ÓÃÄãÕâÖÖ·½·¨Ç󣬽á¹û²»ÊǺÜ×¼£¬ÎÒÕâÑù×ö¹ý£¬µÃ³öµÄÖµÓëʵ¼ÊÈÝÁ¿Óкܴó²î¾à¡£Äã¿ÉÒÔÊÔÊÔ¡¢¡¢¡¢ÎÒҲûÓкõĽâ¾ö·½·¨¡¢¡¢¡¢¡¢ÆÚ´ýÖС¢¡¢¡¢

Êǵģ¬µÃ³öµÄ½á¹ûµÚÒ»¸öÖ»ÓÐ258M¡£Ó¦¸ÃÊDz»×¼µÄ°É¡£

Óà long long  ÊÔÊÔ,ÎÒ»³ÒÉÊÇÔ½½ç¡¢¡¢¡¢¡¢

ÒýÓÃ
Óà long long  ÊÔÊÔ,ÎÒ»³ÒÉÊÇÔ½½ç¡¢¡¢¡¢¡¢

¹þ¹þ ÎÒ˵´íÁË

ѽ£¬ÄÇÑùµÄ»°¾ÍÒç³öÁË£¬Äã¿ÉÄܵÃÓÃlong long¡£

ÏÖÔÚÖµµ¹ÊÇÓÐÁË£¬¿ÉÎÒ×ܸоõ²»Ì«¶Ô¡£Ó²ÅÌÄÄ»áÕâôСÄØ£¬iTotalCapacity = 258M£¬iFreeCapacity = 80M
ÎÒÓÃdf


Ïà¹ØÎÊ´ð£º

PHPÀ©Õ¹CʱµÄÎÊÌâ

ÎÒÓÃPHPÀ©Õ¹Cʱ£¬ÓõÄÊÇÔ´ÂëextĿ¼ÏµÄ./ext_skel
×îºó±àÒë×ÜÊDz»ÄÜÉú³ÉÀ©Õ¹Ä£¿éµÄ.so¶¯Ì¬¿â£¬ÎÒÓõİ汾ÊÇ5.3.0£¬
ÕâÊÇÔõô»ØÊ£¬¸ßÊÖ½â´ðÏÂ

²»ÄÜÉú³ÉʱÓÐɶÌáʾÐÅÏ¢£¿

ÔËÐÐÁË/ext_skel --extname=Ä ......

C\C++ÈçºÎ¼ÆË㺯ÊýµÄµ¼Êý

C\C++ÈçºÎ¼ÆË㺯ÊýµÄµ¼Êý,±¾ÈËÐÂÊÖ£¬Ïëд¸ö³ÌÐò£¬µ«ÊDz»ÖªµÀÈçºÎÏÂÊÖ£¬»¹Íû¸ßÊÖÖ¸µãÒ»¶þ£¬Ð»¹ý¡£
Õâ¸ö¡­¡­

¸úº¯ÊýµÄ¾ßÌåÐÎʽÓйذɣ¬ÄѵÀÄãÏë±à³ö¸ö¡°ÍòÄÜ¡±µÄÇ󵼺¯Êý£¿

°³ÉÏѧʱÏë¹ý×Ô¶¯ÍƵ¼¹«Ê½£¬ºóÀ´ ......

C ³ÌÐòÎÊÌâ (¶þ) - C/C++ / CÓïÑÔ

ÎÊһϣº
#include <stdio.h>
int main()
{
  char x, y, z;
  int i;
  int a[16];
  for(i=0; i<=16; i++)
  {
  a[i] = 0;
  ......

ÇëC/C++¸ßÊÖ½ø£¬Çë½Ì£¡

¹¦ÄÜÊÇʵÏÖ×Ö·û´®µÄ·­×ª£¬²»ÖªµÀÄÄÀïÓдíÎó£¬ÇëÖ¸½Ì
#include <iostream>
#include <stdio.h>

using namespace std;
void reverse()
{
char ch;
scanf("%c",ch) ......

ÄϾ© ÖÐÐË C³ÌÐòÔ±ÕÐƸ

¹¤×÷ÄÚÈÝ Ñз¢

×ʸñÒªÇó£º
211ºÍÖصãԺУ±¾¿Æ 3Ä깤×÷¾­Ñé
211ºÍÖصãԺУ˶ʿ 1Ä깤×÷¾­Ñé

ÆÕͨԺУÔÚ¹¤×÷ÄêÏÞÉϸ÷¼Ó1Äê


ÓÐͨÐÅÏà¹Ø¿ª·¢¾­ÑéÕßÓÅÏÈ£¬µ±È»C/C++ »ù´¡ÒªÔúʵ

à ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ