Jay Khandkar Jay Khandkar - 1 year ago 83
C Question

What can I pass to fopen?

Can I pass a character array to

? For example:

fopen(s, "r");

is declared as a character array and is null terminated.

Answer Source

s must be a null terminated character array.enter image description here

The man pages confirm this

FILE *fopen(const char *path, const char *mode);

You can see that it must be null terminated, since no size argument is given.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download