File Handling in C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Parul Bagadia
    New Member
    • Mar 2008
    • 188

    File Handling in C++

    This is my first program of file handling...
    Here we are supposed to simulate sql language......
    This is ofcourse not the complete program; m done only with insertion and select* thing; insert thing is workin properly but in case of select*; nothing gets displayed; but when i checked it in debugger; it was ok. I mean the object of class student has the information but it doesnt get displayed...
    May be the information m writtin in file is not actually not gettin written in file. I dont know the actual problem; that's what i want to know.
    Now m gettin another error when m done with running it.
    The errror comes as:
    16 bit MS-DOS subsystem
    Turbo C++ IDE
    The NTVDM CPU has encountered an illegal instruction CS:8baa IP:2e32 OP:c6 5f 5e 5d c3 choose close to terminate the application.

    Tell me sth about this in details.
    The compiler m using is of Turbo C++ IDE.
    Code:
    Full Code (125 lines) removed, please read Posting Guidelines
  • Parul Bagadia
    New Member
    • Mar 2008
    • 188

    #2
    Hi,
    When i wrote the same code in Microsoft Visual C++ 6.0. i dont get SQL> as written in the code.. Its always coming after i input the line.. And moreover its comin randomly..
    Sometimes its comin 4 times in a row.
    Can somebody tell me why is this happening.

    Comment

    • Parul Bagadia
      New Member
      • Mar 2008
      • 188

      #3
      In the same code when i wrote
      while(enter[i]!=' ')loop
      it worked. and when i wrote while(enter[i]!=' ' || enter[i]!='\n')it never used to come out of the loop.... i checked it even by debugger...
      I want to know its reason as well.

      Comment

      • Savage
        Recognized Expert Top Contributor
        • Feb 2007
        • 1759

        #4
        Originally posted by Parul Bagadia
        In the same code when i wrote
        while(enter[i]!=' ')loop
        it worked. and when i wrote while(enter[i]!=' ' || enter[i]!='\n')it never used to come out of the loop.... i checked it even by debugger...
        I want to know its reason as well.

        The reason is that you have used OR instead of AND,so if any of those two expressions succeed it will loop again.Obviously enter[i] can't be ' ' and '\n' in same which is required to exit from the while loop when OR logic is used.

        Comment

        • Parul Bagadia
          New Member
          • Mar 2008
          • 188

          #5
          Originally posted by Savage
          The reason is that you have used OR instead of AND,so if any of those two expressions succeed it will loop again.Obviously enter[i] can't be ' ' and '\n' in same which is required to exit from the while loop when OR logic is used.
          Yaeh, actually i got it when i again debugged it but still its not working..
          I guess now there can be some problem in gettin inserted in file..
          I really dont know why its comin out of while loop of selectall function.,

          Comment

          • Parul Bagadia
            New Member
            • Mar 2008
            • 188

            #6
            Hey people, am waitin to know wats wrong with my code...

            Comment

            • Laharl
              Recognized Expert Contributor
              • Sep 2007
              • 849

              #7
              Can we have a snippet of the code that's having a problem? Not the whole code, but a bit, say, this while loop you mention.

              Comment

              Working...