MCPcopy Create free account
hub / github.com/IoLanguage/io / UArray_readFromFilePath_

Function UArray_readFromFilePath_

libs/basekit/source/UArray_stream.c:68–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68long UArray_readFromFilePath_(UArray *self, const UArray *path) {
69 FILE *stream;
70 long itemsRead;
71 UArray *sysPath =
72 (UArray_itemSize(path) == 1) ? (UArray *)path : UArray_asUTF8(path);
73 const char *p = UArray_asCString(sysPath);
74
75 // printf("UArray_readFromFilePath_(\"%s\")\n", p);
76
77 stream = fopen(p, "rb");
78 if (!stream)
79 return -1;
80 itemsRead = UArray_readFromCStream_(self, stream);
81 fclose(stream);
82
83 if (sysPath != path)
84 UArray_free(sysPath);
85 return itemsRead;
86}
87
88int UArray_readLineFromCStream_(UArray *self, FILE *stream) {
89 int readSomething = 0;

Callers 3

IoSeq_newFromFilePath_Function · 0.85
IoFile_rawAsStringFunction · 0.85
IoFile.cFile · 0.85

Calls 5

UArray_itemSizeFunction · 0.85
UArray_asUTF8Function · 0.85
UArray_asCStringFunction · 0.85
UArray_readFromCStream_Function · 0.85
UArray_freeFunction · 0.85

Tested by

no test coverage detected