Make sure that mode contains binary option
| 165 | |
| 166 | // Make sure that mode contains binary option |
| 167 | FILE* myfopen(const char *path, const char *mode) |
| 168 | { |
| 169 | #if (defined(__CUGWIN__)) |
| 170 | char mmode[4]; |
| 171 | int i; |
| 172 | int done = 0; |
| 173 | |
| 174 | for (i=0;;i++) |
| 175 | { |
| 176 | mmode[i] = mode[i]; |
| 177 | if (mode[i] == '\0') break; |
| 178 | if (mode[i] == 'w') done = 1; |
| 179 | if (mode[i] == 'a') done = 1; |
| 180 | if (mode[i] == 'b') done = 1; |
| 181 | } |
| 182 | |
| 183 | if (! done) |
| 184 | { |
| 185 | mmode[i] = 'b'; |
| 186 | mmode[i+1] = '\0'; |
| 187 | } |
| 188 | return fopen(path, mmode); |
| 189 | #else |
| 190 | return fopen(path, mode); |
| 191 | #endif |
| 192 | } |
| 193 | // replace "\r\n" by " \n" and "\r" by "\n" |
| 194 | |
| 195 | size_t myfread(void *ptr, size_t size, size_t nmemb, FILE *stream) |
no outgoing calls
no test coverage detected