#include "stdio.h"
#include "string.h"
#include "stdlib.h"
main(int hh,char *name[])
{
FILE *fwri;
char reada[240],names[240];
[color=red]
if ( hh != 2) {
printf("usage: a.out <Parameter>")
exit(1);
}
[/color]
if (name[1] == NULL)
{
puts("Input file name: ");
gets(names);
name[1]=names;
}
if((fwri = fopen(name[1],"w")) == NULL)
{
printf("I can't create file \"%s\"",name[1]);
exit(main);
}
puts("Input somesin: ");
gets(reada);
while( (strlen(reada) > 0))
{
fprintf(fwri,"%s\n",reada);
gets(reada);
}
fclose(fwri);
puts("Bye !!!");
getchar();
return;
}