uploading a txt file !!!!

i have been trying to upload a txt file .
and it worked for the first time .
but then i changed the text using notepad , not with the studio .
but then it won't upload .
it gives me an assertion alert .
it says expression - (stream !=null)

can anyone help ?

10x ...
how do you mean upload?
do you mean you input data from the txt file, if so, I have the same problem...
Notepad uses two characters for a new line ( '\n' and '\r' ) so that can cause problems
what do you mean?

I use getline to get the line, then analyse it and split it into sections
Last edited on
getline reads all the character until it inds '\n' (for default) but having an extra '\r' could mess it a bit
i don't know why it happens .
i think maybe it has something to do with the encoding that you save the notepad file .
but nonetheless , if i write something that has more then 10 chars , it doesn't work .
so if anyone has anther idea ...
I don't think it is to do with the /n thing, because in mine before saving data from the file I count the lines, (which I've just realised I don't need to do) and I put in a test line afterwards:
cout << linecount << endl;
so I know it is reading the lines correctly

Also, on mine, the problem doesn't seem to be to do with the size of the file, since I've had errors occur on files with content such as "1, fish, 1.2, 56, blur" and not occur when I've used bigger files...

After some investigation, I have discovered that one of the problems I have encountered (
Unhandled exception at 0x773242eb in Game.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0026fa44..
) is to do with the program trying to read data that isn't there.

Last edited on
thank you all , but i figured it out already .
the problem was the location of the file and the encoding .
i solved it by simpley opening a new text file from the visual studio itself .
and then edited the chras inside as i please .
works like a charm ...

:)
well mine still doesn't work :-(
What code do you have for it?
http://cplusplus.com/forum/beginner/7853/ <--The link to my question
Topic archived. No new replies allowed.