📄 tp_file_0.cc
字号:
// file: tp_file_0.cc//// system include files//#include <unistd.h>// isip include files//#include "trace_projector.h"#include "trace_projector_constants.h"// method: open_file_cc//// arguments:// FILE*& fp : (output) file pointer// char_1* file_name : (input) file name// char_1* mode : (input) mode to open the file in//// return: a logical_1 flag indicating success//// this method opens a file and returns the file pointer -- mainly used// to allow for polling the disk several times when a file is not found//logical_1 Trace_projector::open_file_cc(FILE*& fp_a, char_1* file_name_a, char_1* mode_a) { // define local variables // int_4 retry = TP_WAIT_ITER; int_4 delay = TP_WAIT_TIME; // if file does not exist iterate through a sleep loop // for (int_4 j = 0; j < retry; j++) { // open file // fp_a = fopen((char*)file_name_a, (char*)mode_a); // sleep if file not found // if (fp_a == (FILE*)NULL) { fprintf(stdout, "Unable to open %s : trying again in %ld seconds...\n", file_name_a, delay); sleep(delay); } else { break; } } // error and exit if cannot open file after delay // if (fp_a == (FILE*)NULL) { fprintf(stdout, "Open failed for file %s after %ld tries\n", file_name_a, retry); exit(ISIP_PROTO_ERROR); } // exit gracefully // return ISIP_TRUE;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -