// file: $(ECE_1111)/labs/01/l01_03/myprog.cc // // local include files // #include "myprog.h" // main: myprog // // This is a driver program that does some very simple things. // void foo(float** x) { *x = new float[3]; *x[0] = 27.0; // x[1] = 27.0; // x[2] = 27.0; } int main(int argc, const char** argv) { char* str = (char*)"joe.txt"; float x[] = {1, 2, 3}; // declare a variable for status // FILE* fp = fopen(str, "w"); // fprintf(fp, "x = %f\n", x[0]); fwrite(x, sizeof(float), 3, fp); fclose(fp); float y[3]; FILE* fpr = fopen(str, "r"); fread(y, sizeof(float), 3, fpr); fclose(fpr); fprintf(stdout, "y = %f %f %f\n", y[0], y[1], y[2]); // exit gracefully // return(0); }