The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-29-2008
dhanamurthy dhanamurthy is offline
Read Only
 

Join Date: Jun 2006
Posts: 105
Vector Traversing

Hi
i have the following structure
struct S
{
char Mod_num[5];
char val[31];
char chr_nm_cd[11];
}
I am reading a 2GB file and inserting into the structure and writing into a vector.
I feel like only vector will be a right option. I tried with multimap but it is memory intensive and hence i dropped multimap.
I have the scenario
1st record
7285
GROZ788Y
SIZE 00513
2nd record
7286
GROZ720Y
SIZEA00678
3rd record
7455
GROZ788Y
SIZE 00565
4th record
7286
GROZ788Y
SIZE 00513
You can observe that 1st and 4th records are the same except for the MOd_num field where the values are 7285 and 7286, they are differing
so i will have the output as
SIZE 00513 GROZ788Y 2 7286 7285
SIZEA00678 GROZ720Y 1 7286
SIZE 00565 GROZ788Y 1 7455

Can you give me a sample program or some directions to solve this.
Reply With Quote
Forum Sponsor