parent
011318054a
commit
0d8f1d50cd
@ -1,20 +1,42 @@
|
|||||||
#include "CFDStructMainUtils.h"
|
#include "CFDStructMainUtils.h"
|
||||||
|
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
void CFDStructMainUtils::write(std::string path, std::string text) {
|
void CFDStructMainUtils::write(std::string path, std::string text) {
|
||||||
|
std::cout << "start write" << endl;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
char drive[_MAX_PATH], dir[_MAX_PATH], filename[_MAX_PATH], ext[_MAX_PATH];
|
char drive[_MAX_PATH], dir[_MAX_PATH], filename[_MAX_PATH], ext[_MAX_PATH];
|
||||||
_splitpath(path.c_str(), drive, dir, filename, ext);
|
_splitpath(path.c_str(), drive, dir, filename, ext);
|
||||||
_mkdir(dir);
|
_mkdir(dir);
|
||||||
freopen(path.c_str(), "w", stdout);
|
|
||||||
cout << text << endl;
|
// if (FILE *file = fopen(path.c_str(), "w")) {
|
||||||
fclose(stdout);
|
// fprintf(file, "%s", text.c_str());
|
||||||
|
// fclose(file);
|
||||||
|
// }
|
||||||
|
ofstream outfile(path);
|
||||||
|
outfile << text << endl;
|
||||||
|
outfile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFDStructMainUtils::read(std::string path, std::string &text) {
|
std::string CFDStructMainUtils::read(std::string path) {
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
string res;
|
||||||
|
|
||||||
|
ifstream infile(path);
|
||||||
|
if (infile.is_open()) {
|
||||||
|
cout << "openfile" << endl;
|
||||||
|
char c;
|
||||||
|
while (infile >> c)
|
||||||
|
res += c;
|
||||||
|
infile.close();
|
||||||
|
} else {
|
||||||
|
cout << "cant openfile" << endl;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue