Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool status() {
- fstream ind, dat;
- dat.open("datoteka.dat", fstream::binary | fstream::in);
- if(!dat) {
- cout << "status 0 = nema datoteke!";
- cout << "Kreiram datoteku.... Datoteka kreirana!\n";
- dat.open("datoteka.dat", fstream::binary | fstream::out);
- ind.open("datoteka.ind", fstream::binary | fstream::out);
- dat.close();
- dat.clear();
- ind.close();
- ind.clear();
- return false;
- }
- if( dat.peek() == fstream::traits_type::eof()) {
- cout << "status 1 = datoteka je prazna!\n";
- } else {
- streampos fsize = 0;
- dat.seekg(0, fstream::end);
- fsize = dat.tellg() - fsize;
- cout << "status 2 = datoteka sadrzi " << fsize/sizeof(Abcd)<< " zapisa\n";
- }
- dat.close();
- dat.clear();
- ind.close();
- ind.clear();
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment