 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
utab Guest
|
Posted: Sat Feb 25, 2006 11:06 pm Post subject: Searching text in a file |
|
|
Hi,
assume that I am working with a data file like this
====================================Patran .bdf file for CAE
$ 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 (HERE STARTS Note parantheses and contents are
not a part of the file!)
GRID 1 0 0.0 0. 0. 0 123456
GRID 2 0 0.1 0. 0. 0 345
GRID 3 0 0.2 0. 0. 0 345
GRID 4 0 0.3 0. 0. 0 345
GRID 5 0 0.4 0. 0. 0 345
GRID 6 0 0.5 0. 0. 0 345
GRID 7 0 0.6 0. 0. 0 345
GRID 8 0 0.7 0. 0. 0 345
GRID 9 0 0.8 0. 0. 0 345
GRID 10 0 0.9 0. 0. 0 345
GRID 11 0 1.0 0. 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
===================================
and I would like to find where the grid point definitions start(marked
with $ sign) after that I will take the coordinates into
vectors(hopefully). I guess STL could help me and this way I would also
improve my STL knowledge.
I just wanted some advice before start coding this.
Thank you in advance, regards |
|
| Back to top |
|
 |
Victor Bazarov Guest
|
Posted: Sun Feb 26, 2006 12:06 am Post subject: Re: Searching text in a file |
|
|
utab wrote:
| Quote: | assume that I am working with a data file like this
====================================Patran .bdf file for CAE
[..]
$ grid point definitions (HERE STARTS Note parantheses and contents
are not a part of the file!)
GRID 1 0 0.0 0. 0. 0 123456
[..]
===================================
and I would like to find where the grid point definitions start(marked
with $ sign) after that I will take the coordinates into
vectors(hopefully). I guess STL could help me and this way I would
also improve my STL knowledge.
I just wanted some advice before start coding this.
|
Use 'std::string' and 'std::ifstream' and 'std::getline'. Get a book
on the Standard library, or just study the manual on those three elements
of the library. You're bound to arrive at a solution if you know what
you want.
V
--
Please remove capital As from my address when replying by mail |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|