home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
microcrn
/
issue_44.arc
/
MICROCAD.ARC
/
WIDTH.CPP
< prev
Wrap
C/C++ Source or Header
|
1988-08-05
|
615b
|
25 lines
// file: width.cpp
// checks source code width for publication
#define MAXWIDTH 50
#include <stream.hpp>
#include <string.h>
main() {
char line[100], * lp;
char c;
int count = 0;
int width;
while(cin.good()) {
lp = line;
while ( cin.get(c), cin.good() && c != '\n')
*lp++ = c; // get a whole line
*lp = 0; // null terminate
count++; // count the line
// cout << count << ": " << line << "\n";
width = strlen(line);
if ( width > MAXWIDTH) {
cout << "line " << count << " too wide by "
<< width - MAXWIDTH << " characters\n";
}
}}