Stuck With C Assignment
I need to write a program that opens a text file, removes characters such as "@, £" etc which are placed in the middle of words, when an "i" occurs on its own, change it to a capital "I", change the first letter of each sentence to a capital (after every full stop has to be a capital), and then finally write the edited file to a new file
I'm able to write code that opens the existing file and writes it to a new one, however i dont know where to start on writing code to edit the text, i believe that if statements and loops are needed (?)
I'm a total beginner as i'd never programmed before i started my degree, and i'm really stuck.
Any help you could give me would be much appreciated :)
Here is what i have so far:
Im attatched the exisiting file I have to work from
FILE *swbtxt; // declare file pointer
char buffer ;
swbtxt = fopen ("swbtxt.txt","r"); // opens the file
destination = fopen("dest.txt", "w");
if ((swbtxt !=NULL) && (destination !=NULL))
num = fread(buffer,1,10000,swbtxt); // read text
fwrite(buffer,1,num,destination); // write text
fclose(swbtxt); // close file
fclose(destination); // close file
printf ("Finished: swbtxt.txt copied to dest.txt");
printf ("\n%d characters copied\n", num);
if (swbtxt == NULL)
printf("Unable to Open swbtxt.txt\n");
if (destination == NULL)
printf ("Unable to Open dest.txt\n");
So what have you thought on the subject?
Write down, in English (or your own language if it's not English, if you prefer) how you would go about doing the editing process. Write it as a list of steps. Once you have a list of steps, you should be able to come up with some code to perform each of the steps.