Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: segmentation error

  1. #11
    Senior Member
    Join Date
    Dec 2001
    Posts
    134
    i find thid error with the gcc only.
    i understand that there must be some value in the buffer that is why the program does not stop to scanf the value.
    1. can anyone tell how do we check the value in the buffer.
    2. how about clearing the buffer before the scanf statement. if u think this is a good idea then, please can anyone let me know how to clear the buffer.
    U get What U pay for.

  2. #12
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    Originally posted here by harbir
    1. can anyone tell how do we check the value in the buffer.
    By debugging your program. Single step through it and put some watches on your variables.

    2. how about clearing the buffer before the scanf statement. if u think this is a good idea then, please can anyone let me know how to clear the buffer.
    That should not make any difference. The buffer will stay the same (size wise). Your overflowing the buffer somewhere. somehow. The only way to find out is to debug your program.
    Oliver's Law:
    Experience is something you don't get until just after you need it.

  3. #13
    Senior Member
    Join Date
    Dec 2001
    Posts
    134
    ok i will try that
    U get What U pay for.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •