I am trying to read a text from a dataset and write to another dataset.I am copying the content from the dataset to a character and from that character to another dataset.But the char datatype is not getting recognised.It shows an error i cant able to figure out what sort of error it is.Please help me to resolve it.
Hereby i have included the code and error
#include<stdio.h>
void main()
//*int main(int argc, char *argv??(??))
{
FILE *fp1,*fp2;
//*char a??(10??);
char a;
fp1=fopen("DD:FILE","r");
fflush(fp1);
if(fp1==NULL)
{
printf("cannot open this file");
}
else
{
printf("File opened");
}
fp2=fopen("DD:FILE2","w+");
if(fp2==NULL)
{
printf("Not able to open this file");
fclose(fp1);
}
else
{
printf("File opened");
do
{
a=fgetc(fp1);
fputc(fp2,a);
}while(a!=EOF);
fflush(fp2);
printf("File flushed");
fclose(fp1);
fclose(fp2);
printf("File closed");
printf("Process complete");
}
}
void main()
//*int main(int argc, char *argv??(??))
{
FILE *fp1,*fp2;
//*char a??(10??);
char a;
fp1=fopen("DD:FILE","r");
fflush(fp1);
if(fp1==NULL)
{
printf("cannot open this file");
}
else
{
printf("File opened");
}
fp2=fopen("DD:FILE2","w+");
if(fp2==NULL)
{
printf("Not able to open this file");
fclose(fp1);
}
else
{
printf("File opened");
do
{
a=fgetc(fp1);
fputc(fp2,a);
}while(a!=EOF);
fflush(fp2);
printf("File flushed");
fclose(fp1);
fclose(fp2);
printf("File closed");
printf("Process complete");
}
}
Error i got is:
CCN5256 (S) A parameter of type "int" cannot be initialized with an expression of type "FILE *".
CCN6205 (I) The error occurred while converting to parameter 1 of "fputc(int, FILE *)".