Exemplo n.º 1
0
FILE *fopen_write(char *file_data)
{
        FILE *m_File = fopen(file_data, "w");
        if (!m_File)
                print_error_global("open", file_data, 0);

        return m_File;
}
Exemplo n.º 2
0
void write_data_float(char *file_data, int N, int M, float *dat)
{
        FILE *file = NULL;
        int i, j;

	// open file
        file = fopen_write(file_data);
        if (!file)
                print_error_global("open", file_data, 0);
	// write dat
        for (i = 0; i < N; i++) {
                for (j = 0; j < M - 1; j++) {
                        fprintf(file, "%G ", dat[i * M + j]);
                }
                fprintf(file, "%G", dat[i * M + (M - 1)]);
                fprintf(file, "\n");
        }
	// close file
        fclose(file);
}