fstream

    1熱度

    1回答

    我在mac上使用lz4並做了一個實驗來壓縮我的程序中的字符串(名爲str)。 #include <fstream> #include <iostream> #include "lz4.h" using namespace std; int main(){ char str[] = "1010010001000010000010000001000000010000000010000

    0熱度

    1回答

    For example: [ticket.txt] (Number) (Amount) 09 10 13 15 25 21 這是我的代碼: #include <iostream> #include <fstream> using namespace std; int main() { int rowNumber = 0;

    0熱度

    1回答

    我在嘗試替換文件中的文本時遇到問題。 #include <iostream> #include <fstream> void Place(string& seek) { fstream myfile; string holder = ""; myfile.open("testfile.txt"); while (seek != holder)

    0熱度

    2回答

    我一直試圖從一個文件中讀取數字序列到一個2D矢量而沒有顯着的成功。 數據在sequences.txt 1,2,3,4,5 6,3,1 7,4,10,4,1,9 我很少遇到的問題,讀一個未知的長度(格式)的數字序列。 例如,如果它被固定在3號格式,輸入應該是這樣的: input_stream >> integer >> char >> integer >> char >> integer

    1熱度

    2回答

    當我寫一個double到一個文件流,然後寫一個整數,整數作爲額外數字附加到雙精度,我不知道爲什麼會發生。有人可以爲我解釋這個嗎?小例子: #include <iostream> #include <fstream> int main() { std::fstream s("test.bin", std::fstream::binary | std::fstream::trunc

    2熱度

    2回答

    問題 有一個巨大的文件(10GB),一個具有讀取文件和打印出來的單詞數精確重複k倍在文件 我的解決方案 使用ifstream讀取由字的文件字; 插入Word成圖std::map<std::string, long> mp; mp[word] += 1; 一旦文件被讀取時,發現所有詞語的地圖,讓字存在的k次 問題 哪有多線程用於有效讀取文件[按塊讀取]? OR 任何提高讀取速度的方法。 有沒有比地圖

    0熱度

    2回答

    我想輸出輸入文件中的第一個字符是輸出文件中的最後一個字符,反之亦然。但我堅持如何打印輸出。我需要用數組。我將從輸入文件讀入字符數組,並將數組寫入輸出文件。 實施例: INPUT.TXT:A B C dËħ output.txt的:H B C d E中的 This is my code #include <iostream> #include <string> #in

    0熱度

    2回答

    我需要做一個函數,每次點擊按鈕,程序就會根據log_p.txt文件中的一行讀取和操作。 但是,如果我把read t過程放在函數內部,每次讀取第一行。 void ai_fight::getfile() { std::ifstream t("log_p.txt"); ui->pushButton->setEnabled(false); getline(t, rule

    0熱度

    1回答

    我的問題顯示輸出。總是打印多餘的行。我做了一些調查,結果是因爲我的getline。此外,我在文件中的格式道歉 #include <iostream> #include <fstream> #include <string> using namespace std; struct menuItemType { string menuItem; double menuPrice;

    -3熱度

    1回答

    #include<iostream> #include<fstream> using namespace std; string dataFile = "data.txt"; int counter; int main() { string input =""; fstream data; data.open(dataFile, ios::app | i