Skip to content

Instantly share code, notes, and snippets.

@hydai
Created December 20, 2019 14:38
Show Gist options
  • Save hydai/c8b0fabaa2d9bdc711cf6ba81ba46a33 to your computer and use it in GitHub Desktop.
Save hydai/c8b0fabaa2d9bdc711cf6ba81ba46a33 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUF_LEN 1024*16
int main(int argc, char* argv[]) {
FILE *pFile=NULL;
char* buf=NULL;
char name[128];
buf = malloc(BUF_LEN);
memset(buf, 'a', BUF_LEN);
buf[BUF_LEN-1]=0;
for (int i = 0; i < 2147483647; i++) {
sprintf(name, "./garbage%i", i);
pFile = fopen(name, "w+");
printf("pFile = %p\n", pFile);
for (int j = 0; j < 512; j++) {
fprintf(pFile, "%s", buf);
}
fclose(pFile);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment