Hi, it's me again! This time I have a error that occurs while running. I get access violation while trying to read from a file (It is created, and not blank!).
This is detailed error:
1 2 3 4
TXT_RPG.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\mscorlib.resources\v4.0_4.0.0.0_ru_b77a5c561934e089\mscorlib.resources.dll'
A first chance exception of type 'System.AccessViolationException' occurred in TXT_RPG.exe
'TXT_RPG.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file.
An unhandled exception of type 'System.AccessViolationException' occurred in TXT_RPG.exe
It's probably because you're trying to write to readonly memory. On lines 82-82 getline() wants a pointer to char where it will save the data it reads, but you're passing a string literal, which is const. http://www.cplusplus.com/reference/istream/istream/getline/
It's probably because you're trying to write to readonly memory. On lines 82-82 getline() wants a pointer to char where it will save the data it reads, but you're passing a string literal, which is const. http://www.cplusplus.com/reference/istream/istream/getline/
Now I see the problem, but I don't really understand how to solve it, so it will read the first line and save it as the value of bool loaded, and then read the second line and save it as the value of int loaded_health.
The point is that the first argument to ifstream::getline() must be a pointer to some memory that will store the characters that are read from the stream. And the second argument must be a maximum number of characters to read from the stream.
Why are you trying to pass in a string literal as that argument? What is that string "load" that you're passing in supposed to mean?