Hi everyone! I'm just getting into C++ but I have a some experience in programming (if JavaScript counts...)
anyways I was wondering how you would check to see if there is text in a file (as opposed to none at all). For example in JavaScript I would do something like:
but it doesnt seem to work in C++...heres what i was doing in C++ (trimmed down to the problem):Code:if (text_in_file!="") { ... }
Code:char *str = new char[50]; ifstream read_file("example.txt"); read_file>>str; read_file.close(); if (str!="") //<--heres where im stuck { //code goes here } else { //code goes here }