I\'m trying to read data from a fstream but this code doesn\'t work. It puts 0 to the console. Can you help me?
// g++ -Wall main.cpp -o main.exe #include
Just try this code this code will help you
#include #include #include //#include using namespace std; int main() { fstream file("main.txt"); file << "45634w6\n"; file << "dtusrjt\n"; file.close(); file.open("main.txt"); string line; while (!file.fail()) { getline(file, line); cout <> a; }