VScode에서 디버깅을 하면서 변수를 확인하고 싶은데,
vscode 에서 C++을 디버깅할 땐 터미널 input를 못받는다.
따라서 freopen을 사용해야 하는데,
main함수 맨 위에
freopen("input.txt", "r", stdin);
을 추가해주면 된다.
근데 디버깅을 해주니까, input.txt에 있는 데이터가 들어오지 않는다는 것을 발견했다.
찾아보니, launch.json에 있는 cwd 경로를 input.txt가 있는 디렉터리로 설정하면 된다는 것을 알아냈다.
https://stackoverflow.com/questions/65550374/vs-code-on-windows-debugger-does-not-work-with-freopen
VS Code on Windows debugger does not work with freopen
I found this issue, but it was closed https://github.com/microsoft/vscode/issues/112165 The problem is that VSCode can not read data from file when debugging c++ code. Steps to Reproduce: create a...
stackoverflow.com
여기 댓글에 있는 내용
'컴퓨터기본 > Tools' 카테고리의 다른 글
VSCode C++ 개발 환경 설정 (0) | 2021.09.07 |
---|---|
이클립스 기본 설정 (0) | 2021.08.13 |
비주얼 스튜디오(Visual Studio) 단축키 (0) | 2021.06.14 |
Atom editor설치 in Ubuntu Linux (0) | 2021.06.14 |
Node.js 리눅스에 설치 (0) | 2021.06.14 |