www.digitalmars.com         C & C++   DMDScript  

c++.dos.16-bits - fopen requires const char instead of char in other compilers

reply "Lars Hansen" <lars.o.hansen gmx.de> writes:
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;
    }
Feb 16 2003
parent "Walter" <walter digitalmars.com> writes:
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

 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;
     }

Feb 16 2003