every thing works till the fopen, the sprintf works as i'm printing to check that. i just doing know what is causing this not to work
it prints "cannot open (null)" but the filename var does have something assigned to it.
any help will be welcomed
char tmpfilename[10];
char filename[15];
if(argv[2] == NULL){
printf("no output file name specified\n");
printf("would you like to specify one now? (y/n)\n");
scanf("%c", &a);
if(a=='y'){
printf("enter the name of the file to be outputted (less than 10 letters)\n");
scanf("%s", &tmpfilename);
sprintf(filename,"%s.ps",tmpfilename);
printf("%s there should be a string here\n",filename);
---> if(!(out = fopen(filename, "w"))){
fprintf(stderr,"Cannot open %s\n",filename);
exit(2);
}
}
if(a=='n'){
printf("ok, exiting\n");
exit(1);
}
if(a != 'y' && a != 'n'){
printf("unexpected input...exiting\n");
exit(1);
}
}