I'm writing a program that reads from a file, but I'd like the path to the file to be dynamic. I created testing variables first to see if I can even get them to work properly.
The program compiles, but Visual Studio 2010 gives me an error afterward:
"Unhandled exception at 0x5be7d51c (msvcr100d.dll) in read-write.exe:
0xC0000005: Access violation reading location 0x2eaa81e6"
It opens strlen.asm, with arrow pointed to "str_misaligned"
I'm using these header files:
-iostream
-fstream
-string
-stdlib.h
-vector
I tried with these two versions:
1 2 3 4 5
|
//...
string readFile = "read" + '.txt';
//...
ifstream fin(readFile);
//...
|
I thought that maybe it's missing quote signs:
1 2 3 4 5
|
//...
string readFile = "\"read" + '.txt' + '\"';
//...
ifstream fin(readFile);
//...
|
But now I think that using string-type variables might be idiotic for something like that. I don't know what else to use though.