i was under the assumption that in c++ when you use the open command with ios::in|ios:
ut, if the file does not exist, it will create one for you, and if you try and read in from that blank file, it should fill all the values of the record being read in, to nulls in a linux enviroment. here is a sample piece of code, that does not create a file and always returns read failed. any help would be great.
Code:
#include<iostream>
#include<fstream>
using namespace std;
class Block
{
public:
int value1;
int value2;
};
int main()
{
fstream DVDM;
Block test;
DVDM.open("temp", ios::out|ios::in);
test.value2 = -2;
//idealy in this read, value2 will be set to null, and therefore
//the read would work
DVDM.read((char*)&test, sizeof(Block));
if(test.value2 == -2)
cout << "read failed\n";
else
cout << "success\n";
return 0;
}