470,849 Members | 1,132 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

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

Feb 25 '06 #1
1 1808
utab wrote:
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
Feb 25 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by hivie | last post: by
4 posts views Thread by Michi | last post: by
1 post views Thread by Bud Dean | last post: by
5 posts views Thread by robinsiebler | last post: by
3 posts views Thread by Aaron | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.