Home:ALL Converter>Unable to open file in C

Unable to open file in C

Ask Time:2011-03-30T18:25:47         Author:Jame

Json Formatter

i am working in C and want to open a simple text file then perform some processing over it. My code looks like

FILE *pFile;
pFile = fopen("d:\\series.txt", "r");

if (pFile == NULL)
{
    printf("File not found or Unable to open file\nPress any key to continue . . ." );
        getch();
        return;
    }   
    else
    {
         //process here
    }

every time the condition becomes true if (pFile == NULL) so i am not able to perform processing on file.

I check that file exist in my drive with same name and its open properly when i double click on it

Author:Jame,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/5485082/unable-to-open-file-in-c
yy