+ 1
Related fstream lib
#include<iostream> #include<fstream> Int main() { stu s; //stu is a class std::ftream f ("t.txt",std::ios::in|std::ios::out|std::ios::nocreate); f.read((char *),sizeof(s)); s.show; return 0; } Using above code when t.txt is not existed or created, It doesn't work; But when the file is created , then this code works with no error; I want some reason how fstream works ;please help me.thanks
1 Resposta