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
18 Respostas
0
bonne chance ;)
+ 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
+ 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 ;)
+ 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 ^^
+ 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 ^^
+ 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"
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);
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)?
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
0
visph oh sorry I'm new in this app šš you mean like this??
https://code.sololearn.com/cdgqkKb3hNAA/?ref=app
0
yes :)
I will take a look...
0
visph it's Okey I still have too much things to learn
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...
0
visph ok
Thank you š„°š„°
I will do that
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
0
Martin Taylor thank you so much š„°š„° you make it easy for me
0
ććć¼ć« maybe make your code a little more readable?