My old (worked in older versions of OS and compiler) program has these global definitions and code:
The program give me:
// file name hard coded for test purpose only
char printerfile = "C:\\xxx\\testenv\\hrrss\\files\\lpt1.txt";
void main ...
// the (const char *) was added for test purpose
// I get the same wrong result even when I have
// if((Prn = fopen(printerfile,"w")) == NULL)
if((Prn = fopen((const char *)printerfile,"w")) == NULL)
printf("can't open printer; ERROR: %d %s\n", errno, strerror(errno));
can't open printer; ERROR: 2 No such file or directory
errno 2 is ENOENT - No such file or directory
The directory C:\xxx\testenv\hrrss\files exists
I use Visual Studio 2010 on win7 64 bits and I tell the compiler to compile it as C not C++
What am I doing wrong?