關於C 檔案讀取

2021-06-09 13:35:57 字數 822 閱讀 8318

#include #include #include #include #include #define n 10000000  //一千萬

int a[n+1];

void file()           //用於產生檔案的隨機數

void read_cin()

void read_scanf()

void read_cin_syn()

int main()

#include #include #include #include #include #define n 10000000 //一千萬

int a[n+1];

void file() //用於產生檔案的隨機數

void read_cin()

void read_scanf()

int main()

平台:               vc6.0               mingw c

scanf:1.3590            1.4200

cin:                   3.700              4.8650

cin_syn:         3.0340            1.5140

平台: win7 

用std::ios::sync_with_stdio(false);取消同步之後,讀入資料的速度 在mingw中顯著加快。 scanf()表吸良好。

:::vc 開發環境, mingw , linux gcc開發環境細節方面有很多不一樣的地方,細節實現不一樣,傷不起啊

關於C 讀取XML檔案的方法

xml檔案非常簡易,我們可以方便地在任何應用程式中進行讀 寫檔案操作。它是純文字格式,在許多方面類似於html,xml由xml元素組成,每個xml元素包括乙個開始標記 乙個結束標記 以及兩個標記之間的內容。乙個xml檔案舉例 1 ate test tx all 2412 11g 6 ant0 19....

關於shell讀取檔案

不想在shell上花費過多時間。只是想讀取乙個檔案,並把檔案中的內容設定給乙個變數,成功 如下 bin sh thepath cat upper.sh while read line do echo line thepath thepath line done echo thepath while ...

C 讀取檔案

using system using system.collections.generic using system.componentmodel using system.data using system.drawing using system.text using system.window...