基本的に私は自分のコードに問題があります-これは宿題なので、明らかな理由でここに投稿したくないです。私がそうすることが本当に重要になった場合、私はとても立ち往生しているので、そうしなければなりません。
私は2つのテキストファイルを読んでいて、区切り文字もあります。これらの値はコマンドラインから取得されます。この場合の区切り文字はxxであると想定してください。
File a
a
b
c
File b
d
e
Output should be
axxd
bxxe
cxx
問題は、私のコードが最後の行を正しく実行しないことです
私はの出力を取得します
axxd
bxxe
私がすべてのコードを投稿しなくても、私が間違っていることを皆さんが収集できることを願っていますが、私のロジックはこの原則に基づいて機能します。
while not at the end of the file for files a and b
get a line using fgets from a
create a character pointer and set it to the first occurrence of \n in the line using strchr
if the pointer isn't null
set the pointers value to be the end of line
get the line from b as above
and now write the line from a, the separator and the line from b to file