質問編集履歴
2
「識別子が定義されていません」というエラーが解決しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -56,6 +56,16 @@
|
|
56
56
|
using std::ifstream; using std::vector;
|
57
57
|
using std::ostringstream; using std::istringstream;
|
58
58
|
|
59
|
+
vector<string> split(string& input, char delimiter) {
|
60
|
+
istringstream stream(input);
|
61
|
+
string field;
|
62
|
+
vector<string> result;
|
63
|
+
while (std::getline(stream, field, delimiter)) {
|
64
|
+
result.push_back(field);
|
65
|
+
}
|
66
|
+
return result;
|
67
|
+
}
|
68
|
+
|
59
69
|
float UMyBlueprintFunctionLibrary::Csv(const int& Count) {
|
60
70
|
string filename("csvが入っているデータのpath"); //ファイルのパス指定
|
61
71
|
vector<string> strvec;
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
### 発生している問題・エラーメッセージ
|
12
12
|
|
13
13
|
```
|
14
|
-
エラー (アクティブ) E0020
|
14
|
+
エラー (アクティブ) E0020 "std::string" から "const char *" への適切な変換関数が存在しません
|
15
15
|
エラー (アクティブ) E0165 関数呼び出しの引数が少なすぎます
|
16
16
|
```
|
17
17
|
↑return float(std::strtof(strvec.at(Count21)));の部分でエラーが出ています
|
@@ -58,6 +58,8 @@
|
|
58
58
|
|
59
59
|
float UMyBlueprintFunctionLibrary::Csv(const int& Count) {
|
60
60
|
string filename("csvが入っているデータのpath"); //ファイルのパス指定
|
61
|
+
vector<string> strvec;
|
62
|
+
|
61
63
|
ifstream input_file(filename); //指定したファイルを開く
|
62
64
|
if (!input_file.is_open()) { //ファイルが開かなかったとき
|
63
65
|
cerr << "Cannot open the file - '" << filename << "'" << endl; //コメント表示
|
@@ -66,10 +68,10 @@
|
|
66
68
|
|
67
69
|
string line;
|
68
70
|
while (std::getline(input_file, line)) { //csvファイルの最後の行までループを回す
|
69
|
-
|
71
|
+
strvec = split(line, ','); //カンマ区切りで配列に格納
|
70
72
|
}
|
71
73
|
|
72
|
-
return float(std::strtof(strvec.at(Count
|
74
|
+
return float(std::strtof(strvec.at(Count)));
|
73
75
|
}
|
74
76
|
```
|
75
77
|
|