what kind of data does it need?

C program (this is an untested quickie):

/* creates a binary file with MAXDATA integers */
/* includes go here */
#include <stdio.h>
#include <stdlib.h>

/* define global variables */
#define MAXDATA 2000    /* maximum number of data points */

/* function prototypes go here */
unsigned int f( void );

int main (int argc, char *argv[])
{
        FILE            *outfile;
        char            *filename;
        unsigned int    data;
        int             i;

        /* get filename from command line */
        strcpy(filename, argv[1]);
        strcat(filename, ".bin");

        outfile = fopen(filename, "wb");

        for(i=0 ; i<MAXDATA ; i++)
        {
                /* get data */
                data = f();

                /* print the data to a file - each data point is followed by
a CR */
                fprintf( outfile, "%ui\n", data);
        }

        fclose(outfile);
}

unsigned int f( void )
{
        /* put your code to get integers here */
}

> -----Original Message-----
> From: Johan Lim [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, July 12, 2000 10:38 AM
> To:   [EMAIL PROTECTED]
> Subject:      binary file format under linux
> 
> Dear all,
> 
> I run a simulator program under linux.
> This simulator requires an input file
> in binary file format (xxx.bin).
> The contents of this input file is simply
> integers (unsigned).
> If anybody can point out how to make
> this binary file, i'd really appreciate.
> 
> Thanks,
> Johan
> 
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
> 
> 
> -- 
> To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
> as the Subject.


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to