-3
我有兩個文本文件,我打開了,我想將兩個文本文件的內容複製到一個輸出文件。這是迄今爲止我所得到的。如何將一行從.txt文件複製到數組中?
printf("\nWhat is the name of the output file you want to use? (with file extension)\n");
gets_s(thirdfilename);
fopen_s(&text3, thirdfilename, "w");
while (text3 == NULL)
{
printf("\nThis file does not exist, please re-enter the name of the output file you want to use (with file extension)\n");
gets_s(thirdfilename);
fopen_s(&text3, thirdfilename, "w");
}
if (text3 != NULL)
printf("\nYou have successfully opened '%s'\n", thirdfilename);
我不確定是否使用while循環將文本複製到第三個文件或使用for循環。我已經在前面提到的代碼之前創建並打開了前兩個文本。任何幫助深表感謝。
C++方式:'的std :: ofstream的( 「third_file」)<<的std :: ifstream的(」第一個文件「)。rdbuf()<< std :: ifstream(」second_file「)。rdbuf();' –
[如何將單詞從.txt文件複製到數組中。然後在單獨的行上打印每個單詞](http://stackoverflow.com/questions/32670811/how-to-copy-words-from-txt-file-into-an-array-then-print-each-word- on-a-separa) –
您的標題與您的問題文本不符。請糾正它們,以便它們都指向相同的主題。 –