Journal Articles

CVu Journal Vol 11, #5 - Aug 1999 + Programming Topics
Browse in : All > Journals > CVu > 115 (21)
All > Topics > Programming (877)
Any of these categories - All of these categories

Note: when you create a new publication type, the articles module will automatically use the templates user-display-[publicationtype].xt and user-summary-[publicationtype].xt. If those templates do not exist when you try to preview or display a new article, you'll get this warning :-) Please place your own templates in themes/yourtheme/modules/articles . The templates will get the extension .xt there.

Title: An Exercise - Source unknown

Author: Administrator

Date: 03 August 1999 13:15:32 +01:00 or Tue, 03 August 1999 13:15:32 +01:00

Summary: 

Body: 

#include <stdio.h>

int main(int argc, char **argv) {
  int ch;
  FILE *infile = fopen(argv[1], "rb");

  while (EOF != (ch=getc(infile))) 
    if ( ch == '\r' )
      putchar('\n');
    else
      putchar(ch);
  fclose(infile);
  return 0;
}

Beginner's exercise: test program.

Intermediate exercise: add error-checking.

Advanced exercise: add really good error-checking.

Idiot Pedant exercise: identify all portions of this program that are not strictly conforming and identify ways of rewriting the standard to allow a program with similar functionality to be strictly conforming.

For Everyone: What does it do? (hint: think about-of-line encoding on different platforms

Notes: 

More fields may be available via dynamicdata ..