DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T v

⟦f45e78ff7⟧ TextFile

    Length: 1450 (0x5aa)
    Types: TextFile
    Names: »var2ascii.c++«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/image/vartools/var2ascii.c++« 

TextFile

/*
    This contains the work routine that converts an image to
    a ascii file
*/
#include <stream.h>
#include <stdio.h>
#include <double_image.h++>
#include "vartools.h++"


// input is an initialized image
// output is a file pointer open for output
// format is the format to output each number
void
var2ascii2(double_image& input , FILE *output , char *format )
    {
    // output the length and the width
    fprintf(output,"%d %d",input.n_rows(),input.n_cols());

    // iterate through the input image
    while(input++)
	{
	// if at the beginning of a row output a carriage return
	if(input.the_collumn() == 0)
	    {
	    fprintf(output,"\n");
	    }
	// output the element of input
	fprintf(output,format,input());
	}
    
    // print out the comments
    fprintf(output,"\n%s",input.the_comments());

    // make sure the output goes to some file
    fflush(output);
    }

/*
    This is a version of var2ascii that takes an input file rather
    than an initialized image
*/
void
var2ascii(FILE *input, FILE *output , char *format)
    {
    // read in the image
    double_image input_image(READ,input);
    // call the work function
    var2ascii2(input_image,output,format);
    }
/*
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.
*/