Dynamic Array of Strings

B

bstebroc

Hi,
From searching through the FAQ and the web, this seems to be a widely
discussed topic, but I have not come up with a way that quite meets my
needs. I have a sequence of files that contain tab/space separated
data, with anywhere between 10 and 300 columns. Out of this data, I
need only seven columns, but these columns will be selected by the user
at runtime.

My original plan was to read in the first row (with the column headers)
and allow the user to select the seven good columns and then read in
the rest of data in the specified columns. My problem is parsing the
column header line as I get a core dump everytime. Unfortunately, I
have not programmed in C in a long time, so some of the dynamic memory
tricks are a little rusty for me.

Thanks,
~rob
 
I

Ian Collins

Hi,

discussed topic, but I have not come up with a way that quite meets my
needs. I have a sequence of files that contain tab/space separated
data, with anywhere between 10 and 300 columns. Out of this data, I
need only seven columns, but these columns will be selected by the user
at runtime.

My original plan was to read in the first row (with the column headers)
and allow the user to select the seven good columns and then read in
the rest of data in the specified columns. My problem is parsing the
column header line as I get a core dump everytime. Unfortunately, I
have not programmed in C in a long time, so some of the dynamic memory
tricks are a little rusty for me.
Sounds like you have hit a snag before you get to any dynamic memory.
How about posting some code?
 
S

santosh

Hi,

discussed topic, but I have not come up with a way that quite meets my
needs. I have a sequence of files that contain tab/space separated
data, with anywhere between 10 and 300 columns. Out of this data, I
need only seven columns, but these columns will be selected by the user
at runtime.

My original plan was to read in the first row (with the column headers)
and allow the user to select the seven good columns and then read in
the rest of data in the specified columns. My problem is parsing the
column header line as I get a core dump everytime. Unfortunately, I
have not programmed in C in a long time, so some of the dynamic memory
tricks are a little rusty for me.

Please post your attempt. It is the only way that the experts in this
group can help you solve your problem.
 
C

CBFalconer

From searching through the FAQ and the web, this seems to be a widely
discussed topic, but I have not come up with a way that quite meets my
needs. I have a sequence of files that contain tab/space separated
data, with anywhere between 10 and 300 columns. Out of this data, I
need only seven columns, but these columns will be selected by the user
at runtime.

My original plan was to read in the first row (with the column headers)
and allow the user to select the seven good columns and then read in
the rest of data in the specified columns. My problem is parsing the
column header line as I get a core dump everytime. Unfortunately, I
have not programmed in C in a long time, so some of the dynamic memory
tricks are a little rusty for me.

Besides the fact that you showed no code, and that our crystal
balls are somewhat cloudy due to the high price of oil, this
appears to me to be overkill. Look into the use of AWK (or gawk),
which is freely available everywhere and should handle the job with
ease.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top