I tried to make a program that would take a txt file and respond to it. Found some tutorial and used the code from there with some modifications.
But when I run it, it just opens the dos with nothing in it.
Here's the code:
Code:
//This program should take a text file named VCC.txt and read it, put it to a string
//and then if it matches the given string, it should respond
//Includes
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
//The string that the text file will be read to
char textfile[2000];
//The file
fstream file_op("Data\\VCC.txt",ios::in);
//Get line and put it to char textfile
file_op.getline(textfile,2000);
//If textfile is Hello, wich it is, it should respond with saying Hello back, but somehow this doesn't work
if(textfile == "Hello")
{
cout<<"Hello";
}
while(1){}
}
Thanks