I'm trying to make a program that counts the number of lines of a file, when I try to pass the absolute path to the fopen function, is simply tells me that is not found, here is my code:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main(int argc, char *argv[])
{
int i=0;
char array[100];
char caracteres[100];
FILE *archivo;
archivo = fopen("C:Documents and Settingsjuegos psps.txt","r");
if (archivo == NULL){cout<<"Dont Work";}
while (feof(archivo) == 0)
{
fgets(caracteres,100,archivo);
i++;
}
cout << "Number of lines:" << i ;
return 0;
}
How should I pass the absolute path to my program so you can open the file?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…