The simple fopen operation seems to not work. perror returns – Invalid argument. What could be wrong.
I have a ascii file called abc.dat in R:.
int main()
{
FILE *f = fopen("R:\abc.dat","r");
if(!f)
{
perror ("The following error occurred");
return 1;
}
}
Output:
The following error occurred: Invalid argument.
Escape your
\. It must be\\when used in the string.Otherwise, the string is seen by
fopento be including the\a“alert” escape sequence which is an invalid argument to it.Common escape sequences and their purposes are: