// // Programmer: Craig Stuart Sapp // Creation Date: Sat Jan 2 21:40:50 PST 1999 // Last Modified: Sat Jan 2 21:40:50 PST 1999 // Filename: /home/craig/lang/c/detab/detab.cpp // Syntax: C++ // $Smake: g++ -O3 -o %b %f && strip %b // #include #include #define MAXLEN 10000 int main(int argc, char** argv) { int index = 0; char* string; string = new char[MAXLEN + 1]; fstream infile(argv[1], ios::in | ios::nocreate); if (!infile.is_open()) { cerr << "Error: file " << argv[1] << " cannot be opened" << endl; exit(1); } int i; int length; while (!infile.eof()) { infile.getline(string, MAXLEN, '\n'); if (infile.eof()) { break; } length = strlen(string); index = 0; int spaces, j; for (i=0; i