You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
993 B
C++
43 lines
993 B
C++
#include "CFDStructMainUtils.h"
|
|
|
|
#include <direct.h>
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <stdlib.h>
|
|
#include <string>
|
|
|
|
void CFDStructMainUtils::write(std::string path, std::string text) {
|
|
std::cout << "start write" << endl;
|
|
using namespace std;
|
|
|
|
char drive[_MAX_PATH], dir[_MAX_PATH], filename[_MAX_PATH], ext[_MAX_PATH];
|
|
_splitpath(path.c_str(), drive, dir, filename, ext);
|
|
_mkdir(dir);
|
|
|
|
// if (FILE *file = fopen(path.c_str(), "w")) {
|
|
// fprintf(file, "%s", text.c_str());
|
|
// fclose(file);
|
|
// }
|
|
ofstream outfile(path);
|
|
outfile << text << endl;
|
|
outfile.close();
|
|
}
|
|
|
|
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;
|
|
}
|