Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
double2bin.c 323 B
#include <stdio.h>
/*
 * Convert a file of floating point numbers (from stdin) into
 * binary form. Please separate the numbers with whitespace.
 */

int main()
{
    double p;
    while(fscanf(stdin,"%lf",&p)!=EOF)
    {
        if(!fwrite(&p,sizeof(double),1,stdout)) return 1;
    }
    fflush(stdout);
    return 0;
}