Advertisement
2002VB Files #25122

Fake File

Create a file of any type, filled with x bytes. (x = user specified). Exercises file I/O.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
/*
 Fakefile.c by Drat911 (drat911@nwez.com)
 Creates a filename of your choice, filled with characters.
 Usefull for making dummy files, and disguising them as anything ELSE =)
*/
#include <stdio.h>
int main() {
 FILE *ifile;
 long int bytes, i;
 char filename[50], fullfilename[55];
 printf("Fakefile by Drat911 (drat911@nwez.com)\n\n");
 printf("Please enter a filename to write to (Ex: test.exe): ");
 scanf("%s",&filename);
 printf("\n");
 printf("Please enter the size in bytes (1000000 = 1mb): ");
 scanf("%d",&bytes);
 sprintf(fullfilename, "c:\\%s",filename);
 ifile = fopen(fullfilename,"w");
 if (ifile == NULL) {
  printf("Could not open %s for writing. Exiting...\n");
  system("PAUSE");
  exit(0);
 }
 printf("Filling %s with %d characters...\n",fullfilename,bytes);
 for ( i = 0; i < bytes; ++i) {
  fputc('$',ifile);
 }
 printf("Done!\n");
 system("PAUSE");
 return 0;
}
Original Comments (3)
Recovered from Wayback Machine