please can any1 check my code..... it runs into an infinite loop it is to delete duplicate records in a file
@A.Avinash_Goutham you have used while loop here right?
yup but that to make sure that it keeps on asking
because it is not incremented look the value is initialized as int i = 0 ; but u havent used i++ here so value remains 0 always thats y condition remains false well i know java dont know C++ :)
ther's a user menu in there -.-
hmmmm
wait so what is really the problem here so i can understand it
run that code
oh srry i dont know how to do that
um there's an infinite loop
how come
First of all you have to find a code style.Your code looks so chaotic, i cannot read it :P
The problem was on the function fileAdd, you tried to read students name in some weird way i have never seen before, anyway.. try getting string input by scanf("%s",&mystring); and you 'll be fine ;)
i tried to store them in a structure.....
no i tried changing it....that's not the problem
fine there was a problem with scanf for name.........oh sry u mentioned it @infinity_ but the prob with %s is it stops reading after white space so i used %[^/n]
ther's a segmentation fault in dupDelete()
you can try reading it char by char and ignore spaces
yeah.. i saw the segmentation fault, just check you memory allocation, there must be something with it
i donno how to check them...
you make a copy of your file and start removing things till you stop getting seg fault, then you try to recover things you have removed and try to find where the seg fault occurs.You can also try using a debugger, but, at least for me, manual debugging works better
ok i l do it....
No, pleaaasseee don't guess and check to find segfault causes. Haha. Learn to use gdb. Learn to love gdb.
@farmdagnation for small programs such this gdb is not needed.It's kinda stupid actually to use gdb for 50 lines of code...
@farmdawgnation *
Join our real-time social learning platform and learn together with your friends!