내가 이것을 실행하려고 :C++/CLI에서 std :: basic_ifstream :: get()을 사용할 때 AccessViolationException이 발생하는 이유는 무엇입니까?
[email protected]() + 0xae bytes
[email protected]() + 0xa1 bytes
[email protected]() - 0x1f885 bytes
msvcr120.dll!__lock_file() + 0x2ce45 bytes
[Managed to Native Transition]
MyProject.exe!std::basic_filebuf<char,std::char_traits<char> >::_Lock() Line 355 C++
msvcp120d.dll!std::basic_istream<char,std::char_traits<char> >::_Sentry_base::_Sentry_base() + 0x55 bytes
msvcp120d.dll!std::basic_istream<char,std::char_traits<char> >::sentry::sentry() + 0x32 bytes
msvcp120d.dll!std::basic_istream<char,std::char_traits<char> >::get() + 0x5c bytes
[Managed to Native Transition]
MyProject.exe!wmain(int argc = 0x2, wchar_t** argv = 0x054AA3F8) [line # removed] C++
MyProject.exe!__tmainCRTStartup() [line # removed] C
[Managed to Native Transition]
[email protected]() + 0x71 bytes
[email protected]() + 0x227 bytes
[email protected]() + 0x8 bytes
[email protected]() + 0x27 bytes
[email protected]() + 0x1b bytes
왜 이런 일이 않으며, 파일을 읽으려고 할 때 어떻게 내가 그것을 피할 수 :
#include <tchar.h>
#include <fstream>
int _tmain(int argc, TCHAR *argv[])
{
std::basic_ifstream<TCHAR> file("TestInput.txt");
file.get();
}
내가이 스택 트레이스와 함께
AccessViolationException
을 얻을?
왜 저에게는 그런 느낌이 들지 않았습니까?/ – chris
@chris : 그래, 같은 느낌이 들었습니다. 왜 그 중 하나가 VS 2013에 있습니까? – Mehrdad
예, 파일을 만들지 않았지만 시도해 볼 수도 있습니다. – chris