The file data is a text file.
Actually,icol is the number of columns,if the icon is 0,it refers to the node ID,1 for x coordinate, 2 for y coordinate and 3 for z. You think the problem is icol?
and I add this line to the mesh cpp
1 2 3 4 5 6 7 8 9 10 11 12
std::ifstream File("FileName");
if (File.is_open()) {
char c = File.get();
while (File.good()) {
std::cout << c;
c = File.get();
}
}
else {
std::cout << "Error opening file";
}
#include <fstream>
#include <iostream>
int main() {
std::ifstream File("FileName");
if (File.is_open())
for (char c {}; File.get(c); std::cout << c);
else
std::cout << "Error opening file";
}
If it says there's an error opening the file, then it's probably because the file can't be found in the current directory. Does the really file exist? In what directory? Do you mean the string "FileName" or the variable FileName?
Re icol. Maybe/maybe not. At first look the code didn't seem right - but that why I asked for the format of the file data. aux_coord is being pushed for every value read from the line - whether it's values have been changed or not - which again doesn't seem right.....
I have a text file and the name is mesh.txt.
I want to read this file.
In another scenario I want to change the name of argument ind the program read another text file for me. The format of file data is double. At the beginning I told double value
Please post the data file (or a sample if large). Just saying the format of the file data is double is not useful without knowing the layout of the file.