access violations

This is a discussion on access violations within the C++ Programming forums, part of the General Programming Boards category; I'm using fstream.h to read in a text I used the file .get() so I could store the characters one ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    12

    Question access violations

    I'm using fstream.h to read in a text

    I used the file .get() so I could store the characters one at a time. This is causing an access violation, which my roommate said it was trying to write to protected memory in windows, but I dont know anything about it. After I get this error messages my computer restarts itself.

    Does anyone have any ideas as to what I could do to fix this?

    I'll include the file
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    12

    test file

    here is the test file that is referenced in the program
    Attached Files Attached Files

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    Your file-reading is waaaay to long and complex. Why don't you
    just read your whole file into an array of floats by using the
    >> operator of ifstream/float and do all your calculation stuff
    afterwards ?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Do the Access Violations every end?
    By durban in forum C++ Programming
    Replies: 4
    Last Post: 10-12-2005, 10:13 PM
  2. Access Violations
    By nickname_changed in forum C++ Programming
    Replies: 0
    Last Post: 09-22-2003, 03:49 AM
  3. Finding access violations in the source
    By Carlos in forum Windows Programming
    Replies: 4
    Last Post: 11-20-2002, 03:07 AM
  4. ShowWindow causing Access Violations - please help
    By Arrow Mk 84 in forum Windows Programming
    Replies: 8
    Last Post: 08-06-2002, 06:09 PM
  5. Replies: 2
    Last Post: 06-13-2002, 11:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21