|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T t
Length: 1425 (0x591)
Types: TextFile
Names: »test0.h«
└─⟦a05ed705a⟧ Bits:30007078 DKUUG GNU 2/12/89
└─⟦cc8755de2⟧ »./libg++-1.36.1.tar.Z«
└─⟦23757c458⟧
└─⟦this⟧ »libg++/tests/test0.h«
#include <std.h>
#include <stdio.h>
#include <stddef.h>
// change the following if ld++ and crt1+.o are in non-standard directories
#ifndef LDXX
#define LDXX "/usr/gnu/lib/gcc-ld"
#endif
#ifndef CRT1X
#define CRT1X "/usr/gnu/lib/crt1+.o"
#endif
class ifile
{
FILE *fp;
char *name;
public:
ifile (char *name)
{
this->name = new char[strlen(name) + 1];
strcpy (this->name, name);
if ((fp = fopen (name, "r")) == NULL)
{
fprintf (stderr, "could not open input file `%s'\n", name);
exit (1);
}
}
~ifile ()
{
fclose (fp);
if (fp) fprintf (stderr, "closing input file `%s'\n", name);
}
ifile& operator>> (int &i)
{ fscanf (fp, "%d", &i); return *this; }
ifile& operator>> (char *p)
{ fscanf (fp, "%s", p); return *this; }
};
class ofile
{
FILE *fp;
char *name;
public:
ofile (char *name)
{
this->name = new char[strlen(name) + 1];
strcpy (this->name, name);
if ((fp = fopen (name, "w")) == NULL)
{
fprintf (stderr, "could not open output file `%s'\n", name);
exit (1);
}
}
~ofile ()
{
fclose (fp);
if (fp) fprintf (stderr, "closing output file `%s'\n", name);
}
ofile& operator<< (int i)
{
fprintf (fp, "%d", i);
fflush (fp);
return *this;
}
ofile& operator<< (char *p)
{
fprintf (fp, "%s", p);
fflush (fp);
return *this;
}
};