#include <cstdlib>
#include <iostream>
//#include <fstream>
#include <cstring>
usingnamespace std;
int crypt(char* file, float seed)
{
//Open the files for encryption
ofstream input(file, ios::in|ios::binary|ios::ate);
long size = input.tellg();
input.seekg(0, ios::beg);
char* outputname; tmpnam(outputname);
ifstream output(outputname, ios::out|ios::binary);
//Now do the encryption itself
char* byte;
for(int i = 0; i <= size; i++)
{
output.read(byte, 1);
input.write(byte, 1);
}
}
In case I include <fstream>:
C:\Documents and Settings\Laptop\Mijn documenten\letters wisselen.cpp:29: error: 'struct std::ofstream' has no member named 'tellg'
C:\Documents and Settings\Laptop\Mijn documenten\letters wisselen.cpp:30: error: 'struct std::ofstream' has no member named 'seekg'
In case I exclude it:
C:\Documents and Settings\Laptop\Mijn documenten\letters wisselen.cpp:28: error: variable `std::ofstream input' has initializer but incomplete type
C:\Documents and Settings\Laptop\Mijn documenten\letters wisselen.cpp:33: error: variable `std::ifstream output' has initializer but incomplete type
So what am I doing wrong?
Also I would like some advice on the way I open files and coding habits.