so I wanted to write a simple program and to start with I made this. It works fine, but after it finishes it crashes (a window pops up with "the program has stopped working") and returns a big number instead of just returning 0.
Can you tell me what is wrong?
I use Code:Blocks (GNU GCC Compiler).
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cstring>
#include <cctype>
using namespace std;
int main()
{
ifstream ifs;
ofstream ofs;
char input[80];
char output[80];
char text[6];
cout<<"Input file name"<<endl;
cin>>input;
ifs.open(input, ios::in);
if(!ifs)
{
cout<<"Wrong file name!"<<endl;
system("pause");
return 0;
}
cout<<"Output file name"<<endl;
cin>>output;
ofs.open(output, ios::out);
ifs>>text;
if(strcmp("$GPGGA",text))
{
cout<<"DATA FOUND"<<endl;
}
system("pause");
return 0;
}