Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void buildBool(size_t len, const char* path) {
- size_t maxOOOs = len + 2;
- size_t maxSize = 9 + (maxOOOs - 1) + 3 + maxOOOs + 1;
- FILE* fl = fopen(path, "w");
- size_t off[2];
- off[0] = 11;
- off[1] = 17;
- char* strBuf = (char*)malloc(maxSize + 3);
- strBuf[maxSize] = '\0';
- memcpy((void*)strBuf, (void*)"typedef b", 9);
- for (size_t i = 0; i < len; i++) {
- memset(strBuf + 9, 'o', maxSize - 9);
- strBuf[off[0]] = 'l';
- strBuf[off[0] + 1] = ' ';
- strBuf[off[0] + 2] = 'b';
- strBuf[off[1]] = 'l';
- strBuf[off[1] + 1] = ';';
- strBuf[off[1] + 2] = '\n';
- strBuf[off[1] + 3] = '\0';
- off[0]++;
- off[1] += 2;
- fwrite(strBuf, 1, strlen(strBuf), fl);
- }
- free(strBuf);
- fclose(fl);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement