38.7k views
0 votes
Assume that the customer file references a file object, and the file was opened using the 'w' mode specifier. how would you write the string 'mary smith' to the file?

1 Answer

3 votes
Here's an example using the safe fopen:

FILE* customer = NULL;
fopen_s(&customer, "test.txt", "w");
char* msg = "mary smith";
fwrite(msg, sizeof(char), strlen(msg), customer);
fclose(customer);

User Da Rod
by
8.1k points