| | |
Why does vector get out of range?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Well, the MyFile-object has so many details in it, so I can't see if it's opened, but this is the MyFile line in watch:
Since the program is located in "C:\Users\Arne\Documents\Visual Studio 2008\Projects\Bank_project\Debug", wouldn't "..\\..\\..\\..\\..\\..\\..\\data.dat" be C:\file.dat? (For example?)
I could try locating the file another place.
•
•
•
•
Originally Posted by watch
+ MyFile {_Filebuffer={...} } std::basic_fstream<char,std::char_traits<char> >
I could try locating the file another place.
This is bloody creepy! 
I moved the file to \\..\\..\\..\\..\\..\\..\\..\\data
It worked. And, you were right, it stops at the erase-loop.
The reason why it stopped, was that i tried to remove "(" and ")" from "", which logically won't happen. So I added , so that it wouldn't try to delete "(" and ")" where it doesn't exist.
But, by the way, do you know why I have to locate the file somewhere else?
Thank You!

I moved the file to \\..\\..\\..\\..\\..\\..\\..\\data
It worked. And, you were right, it stops at the erase-loop.
The reason why it stopped, was that i tried to remove "(" and ")" from "", which logically won't happen. So I added
C++ Syntax (Toggle Plain Text)
if (!vec[x].empty())
But, by the way, do you know why I have to locate the file somewhere else?
Thank You!
>>But, by the way, do you know why I have to locate the file somewhere else?
The file must be in the same folder that your program is running in unless the open statement tells it otherwise. For example
The file must be in the same folder that your program is running in unless the open statement tells it otherwise. For example
ifstream in("c:\\myfolder\\temp.txt"); Last edited by Ancient Dragon; Apr 16th, 2008 at 11:04 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Other Threads in the C++ Forum
- Previous Thread: The Visual Studio Common IDE Package
- Next Thread: Strange concurrent array overwrite
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node output parameter pointer problem program programming project proxy python read recursion recursive reference return rpg string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






