{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Week05 - ENEE 140 Introduction to Programming Concepts for...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
ENEE 140: Introduction to Programming Concepts for Engineers [email protected] © Gang Qu Spring 2010 Week 5 Program Selection Lab report: Write program to answer the questions 1-3, and name them week05_1.c, week05_2.c, week05_3.c Submit by the following command: submit 2010 spring enee 140 010? 1 week05_1.c submit 2010 spring enee 140 010? 1 week05_2.c submit 2010 spring enee 140 010? 1 week05_3.c Due: 11:59 pm Monday, March 8. Lab 9: Monday March 1 1. file I/O: go through fileIO.c carefully and pay special attention to the followings: a. int main(int argc, char *argv[]) /* this is called command line argument, you can just memorize this as a template for now */ b. FILE *section, *name, *message; /* declare variables of FILE type */ c. name = fopen(argv[2], "r"); /* fopen(): command to open file; argv[]: the way to reference the arguments in the command line, [] is 0-offset; “r”, “w”, “r+”: permission of the file to be opened. */ d. fclose() e. fscanf() /* read in data from the file */ f. fprintf() /* print to a file */ g. two safety check, memorize as template for now if (argc != 4) if (section == NULL) h.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}