質問編集履歴
2
バグが起こる内容の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -11,3 +11,53 @@
|
|
11
11
|
もしくは、判定だけしてエラーメッセージを返すだけでも良いです。
|
12
12
|
|
13
13
|
よろしくお願いします。
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
バグが起こる内容
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
```c++
|
22
|
+
|
23
|
+
#include <iostream>
|
24
|
+
|
25
|
+
#include <fstream>
|
26
|
+
|
27
|
+
#include <sstream>
|
28
|
+
|
29
|
+
#include <iterator>
|
30
|
+
|
31
|
+
#include <string>
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
using namespace std;
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
int main(void){
|
40
|
+
|
41
|
+
char filepath[1000];
|
42
|
+
|
43
|
+
cout<<"ファイルを入力してください\n";
|
44
|
+
|
45
|
+
cin>>filepath;
|
46
|
+
|
47
|
+
ifstream ifs(filepath);
|
48
|
+
|
49
|
+
if(!ifs){
|
50
|
+
|
51
|
+
cerr<<"ファイルの読み込みに失敗しました。名前があっているか確認してください。"<<endl;
|
52
|
+
|
53
|
+
exit(1);
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
```
|
62
|
+
|
63
|
+
ここで、windowsで作ったShift-JIS形式のファイルを読み込もうとすると失敗します。(Xcodeを使ってます。)
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
```C++
|
2
2
|
|
3
|
-
ifsteram ifs("test.txt")
|
3
|
+
ifsteram ifs("test.txt");
|
4
4
|
|
5
5
|
```
|
6
6
|
|