Live for looking at the terrible code of complete blithering idiots such as myself?
How unfortunate...
Anyway, this is just another exercise I'm trying to make sure I understand; the one where you replace a tab with enough spaces to format to the next tab stop.
I'm pretty sure I'm doing something wrong here, but I'd like someone to look the code over and A. tell me what is wrong logically, and B. what is wrong syntactically.
Code:
#include <stdio.h>
#define MAXLEN 1024 /* Set max line length to 1024 */
int tabNuker() {
int newLineMarker, colCtr, strCtr, colWidth;
char strOp[MAXLEN];
strCtr = colCtr = newLineMarker = 0;
printf("What is the width of each tab?");
scanf("%d", &colWidth);
while ((strOp[strCtr] = getchar()) != EOF && strCtr < (MAXLEN -1)) {
if (strOp[strCtr == '\n') {
colCtr = 0;
newLineMarker = strCtr;
}
if ((((strCtr + 1) - newLineMarker) % colWidth) == 0)
++colCtr;
if (c == '\t') {
while (strCtr <= (colCtr * colWidth) && strCtr < (MAXLEN - 1)) {
strOp[strCtr] = ' ';
++strCtr;
}
}
else
++strCtr;
}
}
Edit: It's nowhere near a complete program, just a function snippet that does the job in question...
Edit2: Fixed some stupid omissions/typos.
Edit3: More stupid typos...