#include <stdio.h> 
#include <stdlib.h>  
#include <time.h>  
#include <string.h>  
#define SIZE 200 
int main(void) 
{ 
 FILE *fp; 
 int i, Binary[SIZE]; 
 char name[SIZE]; 
 puts("Enter the name:"); 
 gets(name); 
 strcat(name, ".txt"); 
 fp=fopen(name, "w+"); 
 if(!fp) 
 { 
 fprintf(stderr, "Can't open %s!", name); 
 exit(1); 
 } 
  
 srand((unsigned)time(NULL)); 
 for(i=0; i<SIZE; i++) 
 { 
 fprintf(fp, "%d", rand()%2); 
 if((i+1)%20==0) 
 fprintf(fp, "\n"); 
 } 
  
 if(!fclose(fp)) 
 { 
 printf("%s was set up successfully!", name); 
 } 
 getch(); 
 return 0; 
}