|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 1496 (0x5d8)
Types: TextFile
Names: »main.c++«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
└─⟦this⟧ »EUUGD11/euug-87hel/sec1/image/var2ascii/main.c++«
/*
This is the main routine for translating floating point images
to ascii
*/
#include <stream.h>
#include <stdio.h>
#include <vartools.h++>
int
main(int argc,char *argv[])
{
switch ( argc )
{
// with 0 arguments it is a pipe with default format
case 1:
var2ascii(stdin,stdout,"%lf ");
break;
// with 1 argument it is a pipe with entered format
case 2:
var2ascii(stdin,stdout,argv[1]);
break;
// with 2 arguments it takes from named file to stdout
case 3:
{
FILE *input; // pointer to the input file
if ( NULL == ( input = fopen(argv[2],"r") ) )
{
perror("var2ascii");
return 2;
}
var2ascii(input,stdout,argv[1]);
}
break;
// with 3 arguments it takes from named file to named file
case 4:
{
FILE *input; // pointer to the input file
FILE *output; // pointer to the output file
if ( NULL == ( input = fopen(argv[2],"r") ) )
{
perror("var2ascii");
return 2;
}
if ( NULL == ( output = fopen(argv[3],"w") ) )
{
perror("var2ascii");
return 2;
}
var2ascii(input,output,argv[1]);
}
break;
// otherwise something is wrong
default:
cerr << "Syntax is: var2ascii [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.
*/