Passing FIle pointer as argt
I want to pass input and output file as command line arguments...
I want output file pointer have to be passed as argument to a function..
How can i do it? Is this Ok??
But I am getting Error :cannot convert `_iobuf' to `FILE**' for argument `2' to `void encode(char*, FILE**)'
Code:
int main(int argc,char *argv[])
{
FILE *fp,*fp2;
char str[80],*str1;
fp=fopen(argv[1],"r");
fp2=fopen(argv[2],"w"); // file opened here
...............
encode(str1,*fp2);
}
void encode(char *str,FILE **fp2)
{
................
// Here i want to write it to file
fprintf(*fp2,"%d",no);
}
Help me how to do please?