Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i have written this code but the program wouldn\'t open the file to read. what s

ID: 3632504 • Letter: I

Question

i have written this code but the program wouldn't open the file to read. what should i do if i want the program to open the file and read it. here is my code. i did create a test file name testFile.txt. where should i store testFile.txt at so the program would read this test file
#include <stdio.h>
#include <iostream>
#include <sstream>

using namespace std;
int main()
{
char ch;
int i;
char file_name[40];
FILE * readFile;

printf("Standard Deviation Program ");
for (i = 0; i <= 25; i++)
{
printf("_");
}
printf(" ");
printf("Sample working model written by Van Ha ");
printf("Please enter the name of the file from which to read the data: ");
scanf("%s", file_name);
readFile = fopen(file_name, "r");
if(readFile == NULL)
{
printf("Undable to process this file");
exit(1);
}

cin.get();
cin.get();
return 0;
}

Explanation / Answer

U have to create the file in the same directory where the c file is stored