470,841 Members | 1,037 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Dynamic Array of Strings

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

May 23 '06 #1
3 2147
bs******@yahoo.com wrote:
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.

Sounds like you have hit a snag before you get to any dynamic memory.
How about posting some code?

--
Ian Collins.
May 23 '06 #2
bs******@yahoo.com wrote:
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.


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

May 23 '06 #3
bs******@yahoo.com wrote:

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/>
May 23 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by meyousikmann | last post: by
8 posts views Thread by Peter B. Steiger | last post: by
6 posts views Thread by Materialised | last post: by
5 posts views Thread by Bill Carson | last post: by
8 posts views Thread by Eyeawanda Pondicherry | last post: by
4 posts views Thread by Steph | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.