디렉토리에 파일이 있지만 파일을 읽으려고하는데 그럴 수 없습니다. 내 코드가 잘못되었습니다. 예를 이스케이프 문자로 사용되는 문자열 리터럴 \
에서 http://www.cplusplus.com/forum/beginner/37208/파일을 읽을 수 없습니다. C++
#include <iostream>
#include <fstream>
#include <string>
#define MAX_LEN 100
using namespace std;
string inlasning()
{
string text;
string temp; // Added this line
ifstream file;
file.open ("D:\education\Third course\semestr 2\security\lab1.2\secret_msg.txt");
while (!file.eof())
{
getline (file, temp);
text.append (temp); // Added this line
}
cout << "THE FILE, FOR TESTING:\n" // For testing
<< text << "\n";
file.close();
return text;
}
void main()
{
inlasning();
}
출력은 무엇입니까? – SlavaNov
문자열에 \ 특별한 "뒤에 오는 것"이 무엇인지 기억하십시오. – Gowtham