Since it doesn't compile, I would say no.
Also, str needs to be an array. You can't read 20 chars into a buffer of size 0. BTW, if the file doesn't exist, why try to print the array?
Since it doesn't compile, I would say no.
Also, str needs to be an array. You can't read 20 chars into a buffer of size 0. BTW, if the file doesn't exist, why try to print the array?
printf("%s",str); should be inside the braces. same with fclose. Follow the program flow for if the file fails to open. str will be uninitialized.