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!

Reading a C extract from Java

Status
Not open for further replies.

amarg

Programmer
Nov 19, 2002
106
0
0
IN
Hi,

I am trying to write some utlity program, where I need to read a extract file from JAVA program. Extract is mainly written by C or COBOL process.

In Java, I already manage to get the information about the C or COBOL structure which is used to write the extract, like

Field (int, float, double, long chat etc)
Starting position
Storage (e.g, int will take 4 bytes. float will take 8 bytes etc).

Now I need some guidence, what should I use to read first 4 bytes and convert it into int. and same for other type too.

Thanks,
Amar
 
Oooh this can be tricky. Let's assume the files were written on the same machine type as they're being read on, so there's no Endian problem.

Have a look at java.io.DataInput. It should do what you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top