오답노트
[C,C++] 파일 읽기 본문
std::fstream rawData; // 읽고 쓸 파일.
char* Path = new char[99999];
memset(Path, NULL, sizeof(Path));
printf("경로를 입력해주세요\n");
std::cin >> Path;
//scanf_s("%s", Path);
rawData.open(Path, /*std::ios::binary |*/ std::ios::out | std::ios::in); // Open할때 바이너리, 읽고 쓰기로.
memset(Path, NULL, sizeof(Path));
if (!rawData.is_open()) // 잘 열렸는지 인. 아니면 오류 났다고 해주자
{
//MessageBox("File Open Error.(Don't use Korean title)", "Error", 0);
printf("error\n");
rawData.close();
delete[] Path;
return 0;
}
printf("파일을 열었습니다 닫으려면 아무키나 눌러주세요\n");
//scanf_s("%s", Path);
std::cin >> Path;
rawData.close();
delete[] Path;
'C,C++' 카테고리의 다른 글
scanf, scanf_s 용법 차이 (0) | 2021.03.27 |
---|---|
포인터와 배열의 관계 (0) | 2021.03.27 |
이중배열 동적할당 및 해제 (0) | 2021.03.11 |
int -> char (상하위 비트 분리) (0) | 2021.02.09 |
char -> WORD -> int (비트연산) (0) | 2021.02.09 |