fstream

    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

    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)

    -4熱度

    2回答

    我面臨C++和C的問題,其中我的ifstream對象或文件指針不能正確讀取文本文件,並在輸出時顯示非法字符。但是,當我讀取.dat文件時,它會輸出正確的結果。 這是C代碼: #include <stdio.h> #include <conio.h> #include <ctype.h> void main() { FILE *file; char ch; fil

    0熱度

    3回答

    據我所知,read()和write()有那麼我們可以讀取和直接或文件寫入字節,而我被教導一個byte C++中的等價物是unsigned char,那麼爲什麼他們採取char指針作爲參數? 另外,不要一起來看看這個功能從「bmp文件圖像讀取」圖書館,我發現: bool BMPImage::readInfo() { //... //read bmp and dib heade

    -2熱度

    1回答

    業餘程序員在這裏。我今天的問題是我試圖加載一個.txt文件來顯示在對話框的編輯框中。 在我開始使用代碼之前:我可以通過指定文件位置並繞過來自getopenfilename的加載對話框來工作,並且它可以順暢地工作。但是當我從getopenfilename獲得文件位置時,我似乎無法工作。 相關的代碼是: ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize =

    0熱度

    1回答

    我有許多分成許多小文件的文件。例如,我有 文件1 文件2 ... file10 文件1到file10只是一個文件分割成10。現在我想讀這10個文件,我想避免合併10文件一起創建一個大文件由於文件的大尺寸。我想依次閱讀它們,就好像它是一個大文件。 這就是我現在所擁有的,一次讀取一個文件。 std::ifstream file(filePath, std::ios_base::in | std::io

    -1熱度

    1回答

    是否有可能檢測到可執行文件所在的位置,然後使用該可執行文件(假設它位於文件夾中)找到特定的文件夾並生成帶有可執行文件的文本文件用戶在可執行文件夾中提供的名稱? 我一直在嘗試一些不同的方法,這就是我來了這麼遠(我知道這不對頭) std::cout << "Input the name of the file: "; std::string name = ""; std:: cin