#include
#include
main()
{
ofstream out("test.txt");
if(! out)
{
cout<<"Cannot open output file\n";
return 1;
}
char nums[4]={'a','b','c','d'};
out.write((char *)nums,sizeof(nums));
out.close();
ifstream in("test.txt");
if(! in)
{
cout<<"Cannot open input file\n";
return 1;
}
in.read((char *)& nums,sizeof(nums));
for(int i=0;i<4;i++)
cout< cout<<'\n';
cout< in.close();
return 0;
}
a b c d
4characters read