Problem filehandling in C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Problem filehandling in C

Problem file handling in C visph it's read the text and doesn't calcul the number of the words Then show a "segmentation fault". I'm beginner with using file in C, I didn't find where's the problem i hope you can help , And thank you The code: https://code.sololearn.com/cdgqkKb3hNAA/?ref=app

27th May 2021, 7:37 PM
Manar
Manar - avatar
18 Answers
0
bonne chance ;)
27th May 2021, 10:28 PM
visph
visph - avatar
+ 3
I was rather meaning a link to a sololearn code playground, where we can test and run the code ^^ I just tried to access to your google drive, but it required me to be connected, and I don't want to be tracked by google ;P
27th May 2021, 9:52 PM
visph
visph - avatar
+ 2
マナール translate the comments in your code (and save it, as same project, not as a new one): this will help those who will look at it ;)
27th May 2021, 11:15 PM
visph
visph - avatar
+ 1
well, if it read a file, you cannot simply run it in sololearn playground... however, we could try to explore and debug it more easily :) not sure I could help, but maybe someone else: you'll get more chances to receive help by posting a code playground link anyway... or be a little if not a lot more patient ^^
27th May 2021, 9:57 PM
visph
visph - avatar
+ 1
Martin Taylor, マナール oh, yes, I wanted to add to translate the comments in my last advises, but I finally forgot that point, as french doesn't disturb me ^^
27th May 2021, 10:51 PM
visph
visph - avatar
+ 1
Martin Taylor 🔴A text file 🔴 I want program 🔴Which allows you to count the number of words in this text 🔴 Which displays the number of uppercase characters, the number of lowercase characters, and the number of special characters 🔴 Which displays words of length equal to 4 🔴 Which displays the words containing the string "en" 🔴 Which displays words that end with "ent"
27th May 2021, 11:11 PM
Manar
Manar - avatar
0
void nombre_majuscule_miniscule_caractere_speciaux(FILE*ftext,char text[n]) {int majuscule,miniscule,speciaux; //open fichier pour lire ftext = fopen(text, "r"); //nombre des mot majuscule=miniscule=speciaux=0; while ((ftext=fgetc(ftext))!= EOF) {/* calculer nombre de mot */ if (text>='A' &&text<='Z') // nombre des majescule dans le text majuscule++; else if (text>='a' &&text<='b') // nombre des miniscule dans le text miniscule++; else if(text!=' ') //nombre des caracters speciaux speciaux++; } /* affichage de nombre de caracteres majuscule */ printf("\n"); printf("nombre des caracteres majuscule dans le text = %d\n",majuscule); /* affichage de nombre de caracteres miniscule */ printf("\n"); printf("nombre des caracteres miniscule dans le text = %d\n",miniscule);
27th May 2021, 7:39 PM
Manar
Manar - avatar
0
could you provide a link to your code and describe what's the problem you're facing (rather than giving the code in description and post)?
27th May 2021, 7:53 PM
visph
visph - avatar
0
visph it's read the text and doesn't calcul the number of the words Then show a "segmentation fault". I'm beginner with using file in C, I didn't find where's the problem i hope you can help , And thank you
27th May 2021, 9:52 PM
Manar
Manar - avatar
0
visph oh sorry I'm new in this app 😁😁 you mean like this?? https://code.sololearn.com/cdgqkKb3hNAA/?ref=app
27th May 2021, 9:57 PM
Manar
Manar - avatar
0
yes :) I will take a look...
27th May 2021, 9:58 PM
visph
visph - avatar
0
visph it's Okey I still have too much things to learn
27th May 2021, 9:59 PM
Manar
Manar - avatar
0
sorry, it's above my skill in c/c++ I cannot help you :( anyway, be patient: probably someone could help you ;) however, you could clean your thread to increase your chances, by updating the title (mention that it's about file handling), the tags (mention also at least 'file' along with 'c') and the description (delete the code, paste your two links, and put at least the description you've made after posting the first link), and finally delete your first post...
27th May 2021, 10:13 PM
visph
visph - avatar
0
visph ok Thank you 🥰🥰 I will do that
27th May 2021, 10:26 PM
Manar
Manar - avatar
0
Martin Taylor Yeah it a big mess Actually i studying C language but i didn't practice in this app I will give you the notes of what i want to do
27th May 2021, 11:05 PM
Manar
Manar - avatar
0
Martin Taylor thank you so much 🥰🥰 you make it easy for me
28th May 2021, 10:31 PM
Manar
Manar - avatar
0
マナール maybe make your code a little more readable?
29th May 2021, 5:04 PM
Bot
Bot - avatar