U
utab
Dear All,
I have file like:
$ -----------------------
$ file management section
$ -----------------------
$ -------------------------
$ executive control section
$ -------------------------
SOL 103
TIME 100000
CEND
$ --------------------
$ case control section
$ --------------------
ECHO = NONE
METHOD = 1
DISP = ALL
PARAM,COUPMASS,1
PARAM,OLDSEQ,-1
$ -----------------
$ bulk data section
$ -----------------
BEGIN BULK
$
PARAM AUTOSPC YES
PARAM GRDPNT 0
$
EIGRL 1 1. 10000. 20 0
MASS
$ property definitions
PBARL 1 1 BAR
0.4 0.4
$ material definitions
MAT1 1 21.E+10 0.3 7800.
$ grid point definitions
GRID 1 0 2.5 2.5 0. 0 123456
GRID 2 0 12.5 2.5 0. 0 345
GRID 3 0 12.5 12.5 0. 0 345
GRID 4 0 2.5 2.5 0. 0 345
$ element definitions
CBAR 1 1 1 2 0. 1. 0.
CBAR 2 1 2 3 0. 1. 0.
CBAR 3 1 3 4 0. 1. 0.
CBAR 4 1 4 5 0. 1. 0.
CBAR 5 1 5 6 0. 1. 0.
CBAR 6 1 6 7 0. 1. 0.
CBAR 7 1 7 8 0. 1. 0.
CBAR 8 1 8 9 0. 1. 0.
CBAR 9 1 9 10 0. 1. 0.
CBAR 10 1 10 11 0. 1. 0.
ENDDATA
I am trying to write a different information in the portion between
$ grid point definitions
and
$ element definitions
When I run the program, it hangs, Could you please help me overcome
this. Could you also specify some good tutorials on the combination of
GDB+DDD if you know some. My code is below:
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
int main()
{
char linein[80];
fstream inFile("fo.dat",ios::in | ios:ut );
if (!inFile) // Always test file open
{
cerr << "Error opening input file" << endl;
return -1;
}
while(inFile.getline(linein,80)){
if(strcmp(linein,"$ grid point definitions") == 0){
cout << "found" << endl;
inFile.ignore();
string x="try";
while(inFile.get() != '$'){ // read until the other block
inFile.seekg(23,ios::cur);
inFile << "deneme";
inFile.getline(linein,80);
inFile.ignore();
}
}
}
inFile.close();
return 0;
}
I have file like:
$ -----------------------
$ file management section
$ -----------------------
$ -------------------------
$ executive control section
$ -------------------------
SOL 103
TIME 100000
CEND
$ --------------------
$ case control section
$ --------------------
ECHO = NONE
METHOD = 1
DISP = ALL
PARAM,COUPMASS,1
PARAM,OLDSEQ,-1
$ -----------------
$ bulk data section
$ -----------------
BEGIN BULK
$
PARAM AUTOSPC YES
PARAM GRDPNT 0
$
EIGRL 1 1. 10000. 20 0
MASS
$ property definitions
PBARL 1 1 BAR
0.4 0.4
$ material definitions
MAT1 1 21.E+10 0.3 7800.
$ grid point definitions
GRID 1 0 2.5 2.5 0. 0 123456
GRID 2 0 12.5 2.5 0. 0 345
GRID 3 0 12.5 12.5 0. 0 345
GRID 4 0 2.5 2.5 0. 0 345
$ element definitions
CBAR 1 1 1 2 0. 1. 0.
CBAR 2 1 2 3 0. 1. 0.
CBAR 3 1 3 4 0. 1. 0.
CBAR 4 1 4 5 0. 1. 0.
CBAR 5 1 5 6 0. 1. 0.
CBAR 6 1 6 7 0. 1. 0.
CBAR 7 1 7 8 0. 1. 0.
CBAR 8 1 8 9 0. 1. 0.
CBAR 9 1 9 10 0. 1. 0.
CBAR 10 1 10 11 0. 1. 0.
ENDDATA
I am trying to write a different information in the portion between
$ grid point definitions
and
$ element definitions
When I run the program, it hangs, Could you please help me overcome
this. Could you also specify some good tutorials on the combination of
GDB+DDD if you know some. My code is below:
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
int main()
{
char linein[80];
fstream inFile("fo.dat",ios::in | ios:ut );
if (!inFile) // Always test file open
{
cerr << "Error opening input file" << endl;
return -1;
}
while(inFile.getline(linein,80)){
if(strcmp(linein,"$ grid point definitions") == 0){
cout << "found" << endl;
inFile.ignore();
string x="try";
while(inFile.get() != '$'){ // read until the other block
inFile.seekg(23,ios::cur);
inFile << "deneme";
inFile.getline(linein,80);
inFile.ignore();
}
}
}
inFile.close();
return 0;
}