Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unformatted / formatted files

Status
Not open for further replies.

flav256

Programmer
May 28, 2003
21
0
0
FR
running fortran under Sun-UNIX

I'd like to read an unformatted data file (output from another software). This file is quite big (~900Mo) and I don t want to convert it.

The aim is to find a keyword in the file, read the following values, go to the next occurence of the keyword, read the following values... until the end of the file.


Could you help me

Thanks

F
 
Machine : SunW, ultra 60 , sparc
OS : SunOS 5.7

thanks for your help!!!
 
A piece of psuedo code might help you. It will work, I use the technique all the time..

VARIABLES: findthis,findthislen,StuffFromFile

first: read findthislen bytes from the file
load into StuffFromFile
initialize findthis with what you need to find
loop;
compare findthis to StuffFromFile
if equal.. do what you need
else
get ONE byte from file
shift one byte (left) from StuffFromFile
'OR' new byte into StuffFromFile
endif
goto loop

Tedious YES but generally quick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top