home *** CD-ROM | disk | FTP | other *** search
- /*
- This is the main routine for translating
- ascii to floating point images
- */
-
- #include <stream.h>
- #include <stdio.h>
- #include <vartools.h++>
-
- int
- main(int argc,char *argv[])
- {
- switch ( argc )
- {
- // with 0 arguments it is a pipe
- case 1:
- ascii2var(stdin,stdout);
- break;
- // with 1 arguments it takes from named file to stdout
- case 2:
- {
- FILE *input; // pointer to the input file
- if ( NULL == ( input = fopen(argv[1],"r") ) )
- {
- perror("ascii2var");
- return 2;
- }
- ascii2var(input,stdout);
- }
- break;
- // with 2 arguments it takes from named file to named file
- case 3:
- {
- FILE *input; // pointer to the input file
- FILE *output; // pointer to the output file
- if ( NULL == ( input = fopen(argv[1],"r") ) )
- {
- perror("ascii2var");
- return 2;
- }
- if ( NULL == ( output = fopen(argv[2],"w") ) )
- {
- perror("ascii2var");
- return 2;
- }
- ascii2var(input,output);
- }
- break;
- // otherwise something is wrong
- default:
- cerr << "Syntax is: ascii2var [input [output]]\n";
- return 1;
- }
- return 0;
- }
- /*
- Copyright (C) 1986, David Sher in the University of Rochester
- Permission is granted to any individual or institution to use, copy, or
- redistribute this software so long as it is not sold for profit, provided
- this copyright notice is retained.
- */
-