| 66 | } |
| 67 | |
| 68 | long 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 | |
| 88 | int UArray_readLineFromCStream_(UArray *self, FILE *stream) { |
| 89 | int readSomething = 0; |
no test coverage detected