February 16, 2003 fopen requires const char instead of char in other compilers | ||||
---|---|---|---|---|
| ||||
The following code produces an error about an explicit cast needed for arg 1 of fopen from char to const char. DMC version 8.29n How do I get this code to work? Miracle C compiles without warning or errors. #include <stdio.h> int main (int argc, char* argv[]) { FILE f; f=fopen(argv[1],"r"); fclose(f); return 0; } |
February 16, 2003 Re: fopen requires const char instead of char in other compilers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Hansen | Replace: FILE f; with: FILE *f; "Lars Hansen" <lars.o.hansen@gmx.de> wrote in message news:b2nvhd$1bf7$1@digitaldaemon.com... > The following code produces an error about an explicit cast needed for arg 1 > of fopen from char to const char. DMC version 8.29n > How do I get this code to work? > Miracle C compiles without warning or errors. > > > #include <stdio.h> > > int main (int argc, char* argv[]) > { > FILE f; > > f=fopen(argv[1],"r"); > > fclose(f); > > return 0; > } > > |
Copyright © 1999-2021 by the D Language Foundation