Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : PCCAPP.ZIP
Filename : LINE.H

 
Output of file : LINE.H contained in archive : PCCAPP.ZIP
// line.h: Defines the class Line.
const MAXLINE = 160; // Maximum number of characters in a line.
const ENDCHAR = '#'; // Character to signify end of line.

class Line
{
// This class represents a line of text. Operations are provided to read
// and write the text, and also to compare lines.
public:
// Initialize my line - set it empty.
Line () { length = 0; }
// Repeatedly read characters from "in" and write them into my line
// until a newline or ENDCHAR is read. Set "end" to true if a newline has
// been read. Return the number of characters read, not counting the
// newline. My old line is wiped out before reading any characters.
// Will not work if there are more than MAXLINE characters to be read.
int ReadfromKeyboard (InputStream *in, int &end);
// Repeatedly read characters from "in" and write them into my line
// until a newline or ENDCHAR is read, or until there are no more
// characters to be read. Set "end" to true if a newline has
// been read. Return the number of characters read, not counting the
// newline. My old line is wiped out before reading any characters.
// Will not work if there are more than MAXLINE characters to be read.
int ReadfromFile (ReadFileStream *in, int &end);
// Write my line and a newline to "out". Return the number of characters
// written, including the newline.
int WriteToScreen (OutputStream *out);
// Write my line and a newline to "out". Return the number of characters
// written, including the newline.
int WriteToFile (WriteFileStream *out);
// Return the length of my line, not counting the newline at the end.
int Length () { return length; }
// Return true if l1 has the same contents as l2.
friend int equal (Line *l1, Line *l2);
private:
char linechar [MAXLINE]; // The characters in my line.
int length; // The number of characters in my line, not counting newline.
};

inline int equal (Line *l1, Line *l2)
{
// This function returns true if lines l1 and l2 are equal, that is, they
// have the same length and all their characters are equal.
if (l1 -> Length () != l2 -> Length ())
return 0;
else
{
int len = l1 -> Length ();
for (int i = 0; i < len; i++)
if (l1 -> linechar [i] != l2 -> linechar [i])
return 0;
return 1;
}
}


  3 Responses to “Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : PCCAPP.ZIP
Filename : LINE.H

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/