Hello, i'm new to this forum and this's my 1st time posting a code. my issue is that i have a code that should read from a file called ( ex: word or text), but it does not read the file it jUst gives me the error (could not open the file) here is the code: ( I'M USING C NOT C++):
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <process.h>
//#include <stdafx.h>
//#include <iostream>
int main (int argc, char *argv[])
{
FILE *pFile;
char name [9999];
// open the file
pFile = fopen("c:word", "r");
if (pFile != NULL)
{
fscanf(pFile,"%s", name);
fprintf("%s\n", name);
fclose (pFile);
}
else
{
printf("Could not open the file.\n");
}
//exit(1);
getch ();
}