Files and I/O

Hard 28 points

Create a file "test.txt" with content "Hello C", then read and display its content.

C can read and write files. fopen() opens a file, fwrite() writes, fread() reads, fclose() closes. FILE* represents a file.

Well done! 🎉
Your answer is correct! You earned 28 points.
Not quite...
Try again! You can do it.

Your code

Hint
Use FILE *f = fopen("test.txt", "w"); fwrite("Hello C", 1, 7, f); fclose(f); then read with fopen("test.txt", "r");

Result

Click "Run code" to see the result of your code. Click "Submit" to check if your answer is correct.