#ifndef LINES_H #define LINES_H /////////////////////////////////////////////////////////////// // lines.h - make a line of chars // // ver 1.2 // // manual page // // // // Language: Visual C++, ver 6.0 // // Platform: Micron dual Pentium Pro 200, Win NT 4.0 // // Application: CSE784 demonstration // // Author: Jim Fawcett, CST 2-187, Syracuse Univ. // // (315) 443-3948, fawcett@ecs.syr.edu // /////////////////////////////////////////////////////////////// /* lines Operations: ================= The purpose of this module is to build a line of chars from a C string, a file, or an empty block. Users are expected to free line when done with it. char *line = makeLine("this is a line"); Copies literal into allocated heap memory. char *line = getLine(FILE *fptr); Reads line from file into allocated heap memory. File can be stdin. char *line = getBlock(size); Allocates block of size bytes. Fills block with null terminators. */ /* */ /////////////////////////////////////////////////////////////// // maintenance page // /////////////////////////////////////////////////////////////// // Build Process // // // // Files Required: // // lines.h, lines.c // // // // Integrated Environment: // // - create a Win32 Console project and add lines.c, lines.h // // - select Project\Settings\C/C++ // // enter ,TEST_LINES in Preprocessor Definitions: edit box // // - compile, link, and run // // // // Command Line Environment: // // cl /GX /DTEST_LINES lines.c // /////////////////////////////////////////////////////////////// /* Maintenance History: ver 1.2 : 15 Jan 00 - fixed bug in getLine(FILE *fptr) which failed to check for NULL input - fixed bug in makeLine(char *s) which failed to append a terminating null to line - fixed bugs in test stub - cosmetic changes to these comments ver 1.1 : 31 Mar 97 - strip formfeeds ver 1.0 : 07 Sep 96 - first release */ /* /////////////////////////////////////////////////////////////// // Declarations // /////////////////////////////////////////////////////////////// */ #include char *makeLine(char *s); /* returns pointer to line containing s */ char *getLine(FILE *fptr); /* returns pointer to next line from file */ char *getBlock(int size); /* returns pointer to block of size bytes */ /* filled with null terminators */ #endif