Cryptography Reference
In-Depth Information
for(inti=0;i<=DIGITS_L (ln.n_l); i++)
{
if (write_ind_ushort (s, ln.n_l[i]))
{
LINT::panic (E_LINT_EOF, "ofstream operator<<", 0, __LINE__);
}
}
return s;
}
Before a LINT object is written to a file, the file must be opened for writing, for
which one could use the constructor
ofstream::ofstream (const char *, openmode)
or the member function
ofstream::open (const char *, openmode)
In each case the ios flag ios::binary must be set, as in the following example:
LINT r ("0x0123456789abcdef");
// ...
ofstream fout ("test.io", ios::out | ios::binary);
fout << r << r*r;
// ...
fout.close();
The importation of a LINT object from a file is effected in a complementary
way, with analogous operators, to that of output of a LINT object to a file.
friend ifstream& operator >> (ifstream& s, LINT& ln);
friend fstream& operator >> (fstream& s, LINT& ln);
Both operators first read a single value, which specifies the number of digits
of the stored LINT object. Then the corresponding number of digits are read in.
The USHORT values are read according to the above description under the action of
the function read_ind_ushort() :
ifstream& operator>> (ifstream& s, LINT& ln)
{
if (read_ind_ushort (s, ln.n_l))
{
Search WWH ::




Custom Search