Is this code right for writing a character array (referenced by a char pointer) to a file?
const char* charBuf;
FILE *outputFile = fopen("output", "a");
fprintf(outputFile, "%s\n", *charBuf);
fclose(outputFile);
Assume buf points to some character array.
File mode needs a quote:
unless you have a c-string
adefined with the mode.Assuming you have stored some value into
charBuf, you have to use the string in fprintf.*charBufrefers to the first character in that string.You need to show more code for a better answer.