Skip to content

Instantly share code, notes, and snippets.

@pgrm
Created November 22, 2012 11:25
Show Gist options
  • Save pgrm/4130672 to your computer and use it in GitHub Desktop.
Save pgrm/4130672 to your computer and use it in GitHub Desktop.
AMPP - crappy loop
do {
ch = fgetc(in1);
if ( ch == EOF ) break;
LOOP1: if ( ch == 10 || ch == 13 ) {
// newline or carriage return
ch = fgetc(in1);
if ( ch == EOF ) break;
goto LOOP1;
}
// Bad style with 'goto', but then
// one need not assume there aren't 2 '\n' in a row
while ( isdigit(ch)|| ch==' ' ) ch=fgetc(in1);
// skip over position number and blanks
a[++i]= char2AA(ch); // preincrement and cast
if (i+1==N) break; // don't overflow array size
} while ( 1 ); /** infinite while loop */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment