0

Can someone find the error?

My program doesn't work and i don't understand why. Can someone help me please? Here is the code with comments: https://code.sololearn.com/c5KYO35uiXh7 Thank you

11th Jan 2018, 10:33 PM
Jacinto Lima
Jacinto Lima - avatar
5 Answers
+ 2
it cannot find the file "teste.txt" (line 81) keep in mind that the programs is running on Sololearn's server, your device only receives and displays the output. i suggest creating the file you want to read within your program to solve the problem.
11th Jan 2018, 10:45 PM
seamiki
seamiki - avatar
+ 2
This works, but because of the way you added to link list the lines end up backwards. https://code.sololearn.com/c01eLF9JcrR2 Changes I made: Line 38 copy phrase pointer into the new structure. Line 40 added initialization of prev Line 41 added test for list != NULL Line 67 test for \n (LineFeed) at the end of the string Line 68 replace it with \0 (Null) Line 96 remove & of list
12th Jan 2018, 1:47 AM
John Wells
John Wells - avatar
+ 2
Ok, i took some time to understand how it works, and i can see my mistakes. The program is working correctly now. Thank you all!
13th Jan 2018, 1:56 PM
Jacinto Lima
Jacinto Lima - avatar
+ 1
Thank you John Wells, I can't test it now but I understand the modifications and I appreciate it. I'll put a feedback later.
12th Jan 2018, 7:36 AM
Jacinto Lima
Jacinto Lima - avatar
0
Yes, this is a copy of the code. I try it with eclipse with the file "teste.txt" on the folder. And the program find the file because if i erase it i have the message "Cannot open the file!" from the else. But the program don't copy the lines, and sometimes show me symbols. (sorry for my english)
11th Jan 2018, 11:04 PM
Jacinto Lima
Jacinto Lima - avatar