Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(int argc, char *argv[])
- {
- int r,g,b;
- int count;
- FILE *fp;
- float x,y,z;
- if(argc!=2)
- {
- fprintf(stderr,"Usage: %s (1)InputFileName.txt\n",argv[0]);
- return 0;
- }
- if((fp=fopen(argv[1],"r"))==NULL)
- {
- printf("The file can't be opened. The program is exit.\n");
- return 0;
- }
- count=0;
- while (fscanf(fp,"%f,%f,%f,%d,%d,%d", &x, &y, &z, &r, &g, &b)!= EOF)
- {
- printf("%f,%f,%f,%d,%d,%d\n", x, y, z, r, g, b);
- count=count+1;
- }
- printf("total=%d\n",count);
- fclose(fp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement