-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
45 lines (37 loc) · 1.3 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
//set to true to show additional debug informations
const bool showDebug = false;
const int x_resolution = 512;
const int y_resolution = 512;
//Bearbeiten auf entsprechenden Dateipfad der Inputdatei
string dataFilePath = "C:\\Code\\Hauptflamme.txt";
double input_data[x_resolution][y_resolution];
void importFromFile(string filePath){
string curInputVal;
// Datei einlesen
ifstream readMyFile(filePath);
// Teste, ob die Datei öffnebar ist.
if (readMyFile.is_open()){
if (showDebug) cout<<"Starting import from file."<<endl;
//Index des aktuell eingelesen Wertefeldes
int input_index=0;
//Liest die Datei Block fuer Block ein
while (getline(readMyFile, curInputVal,' ')) {
if(!curInputVal.empty()){
if (showDebug) cout << input_index<<" : "<<stod(curInputVal)<<endl;
input_index++;
input_data[ input_index % x_resolution ][ input_index / x_resolution ]=stod(curInputVal);
}
}
cout<<"Finished importing values from file.";
}
// Datei wird geschlossen
readMyFile.close();
}
int main () {
importFromFile(dataFilePath);
return 0;
}