Hi, currently im working on a project for uni but i have no knowledge in C at all
basically what im trying to do is remove all * !"£$%^&*()- and double spaces from a text file
so far i am able to copy the text file so that im not using the original one so the user inputs what file they want to open and then specifies which name to save it as
has anyone any idea how this works
currently i have this
FILE * fpIn;
FILE * fpOut;
char a;
char *a
char array[100];
char filename[50];
char filename1[50];
int main(void)
{
printf("Enter the name of file to open ");
gets(filename);
fpIn=fopen(filename,"r");
if
(fpIn==NULL)
printf("ERROR - cannot open file please try again");
else
printf ("Enter the name you wish to call the new file ");
gets(filename1);
fpOut=fopen(filename1,"w");
if (fpOut==NULL)
printf("Error cannot write new file! please try again");
else
printf("File has opened correctly");
while(fgets(array, sizeof(array), fpIn))
{
fprintf(fpOut, "%s", array);
}
fclose(fpIn);
fclose(fpOut);
return 0;
}
this is a massive thing for me to do as i am basically self learning in 5 days please can anyone help me
i have tried
if ((a = strchr(array, '\n')) != NULL)
*a = '\0';
please can someone help