MCPcopy Create free account
hub / github.com/Singular/Singular / ReadFile

Function ReadFile

ppcc/adlib/os.cc:9–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#endif
8
9Str *ReadFile(FILE *fp) {
10 char buffer[65536];
11 if (fp == NULL)
12 return NULL;
13 StrArr *result = new StrArr();
14 for (;;) {
15 size_t nbytes = fread(buffer, 1, sizeof(buffer), fp);
16 if (nbytes == 0)
17 break;
18 result->add(new Str(buffer, nbytes));
19 }
20 return StrJoin(result, "");
21}
22
23Str *ReadFile(const char *filename) {
24 FILE *fp = fopen(filename, "r");

Callers 5

JimReadFdFunction · 0.85
MainFunction · 0.85
ReadLinesFunction · 0.85
ReadProcessFunction · 0.85
ReadSourceFunction · 0.85

Calls 3

StrJoinFunction · 0.85
c_strMethod · 0.80
addMethod · 0.45

Tested by 1

MainFunction · 0.68