ユーザーが指定したフォルダ内にファイルと同様にファイルを作成するにはどうすればよいですか?Cユーザーが指定したファイルとフォルダを作成する
これは私の機能の一部です:どちらか一方
char* folder = *(argv + 2); //"C:\\Users\\User\\Desktop\\New folder";
if (!(log = fopen("folder\\file.txt", "a")))// checking if there is any problem with the file
{
printf("The log file has not created correctly, closing the program\n");
system("PAUSE");
exit(1);
}
あなたはファイル操作に文字列変数を渡すことができます。文字列にパスとファイル名を作成し、それをファイル呼び出しに渡します。 –
@johnelemans OPはC言語になっているので、 "strings"はありません – BackDoorNoBaby
@ ariel20どのようにディレクトリがあなたから渡されていますか?それは 'char *'ですか? – BackDoorNoBaby