/* Return NULL if the connection could not be opened. */ FILE * gp_open_printer(char fname[gp_file_name_sizeof], int binary_mode) { return (strlen(fname) == 0 ? 0 : fname[0] == '|' ? popen(fname + 1, "w") : rbfopen(fname, "w")); }
int main(int argc, char** argv) { FILE* file; time_t t; int i = 0; file = rbfopen("demo.txt", 10); for (i = 0; i < 3; ++i) { time(&t); fprintf(file, "(%lu) this is line #%d\n", t, i); fflush(file); sleep(2); } // fflush(file); fclose(file); return 0; }