Need some help in writing a simple C program 
Author Message
 Need some help in writing a simple C program

I have not seen C since 1988 and yesterday, I was given a small
program to write in C. Being a database guy I am not sure even where
to begin from. But, last night I tried to put some simple concepts
together. The requirement is:

Accept a pointer array.Each element in the pointer array is a record
that is comma delimited. Take each of these records, parse them out
and write to an oracle database. I think I can figure out how to write
to Oracle if I can parse the records out properly.

Here is what I have so far ... now don't laugh since this is a hack
and it is based on a day's worth of learning. For now, I just created
the array locally just to get the code working. I just need to have
something working very soon. Any help will be appreciated.

Thanks

#include <stdio.h>
#include <string.h>
#include <string.h>
#include <stdlib.h>

int i, k, w,l,m;
int indx[3];
char *column;
char *str;
char delimiter = ',';

int str_len (char *s)
{
  char *p = s;

  while (*p != '\0')
      p++;
  return p - s;

Quote:
}

char* find_column(char *r,int start,int end)
{
    char *tmp = r;
    char *col;
    printf("%d %d\n",start,end);
      while ((*tmp++ = *col++) && ((tmp-r) >=start) && ((tmp -r) <
end))
        {
          ;
        }
     return (col);

Quote:
}

int main(void)
{
char *string1[] = {"CLB,11.100000,20021211163304","PB,8.860000,20021211163301","STNR,13.100000,200212111617
17","TEM.SM,NoData","FP.FP,NoData","ANA.SM,NoData","UNA.NA,NoData","WVC.FP,NoData","MMT,5.810000,2002121116
3303","BRM,16.320000,20021211163301"};

for (i=0;i<10;i++)
  {
    w=str_len(string1[i]);
    char *str = string1[i];
    k=1;
/*    printf("%s  %i\n",string1[i],w); */
    while (*str != '\0')
      {
        if ((*str == delimiter) && (*str != '\0'))
           {
            indx[k] = str - string1[i];
/*            printf("%d \n",k); */
            k++;
           }
        str++;
      }
    for (l=1;l<k;l++)
    {
      printf("%s %d %d  %d\n",string1[i],indx[l-1],indx[l],k);
      column=find_column (string1[i],indx[l-1],indx[l]);
    }
/*    printf ("FINAL %s\n",*column); */
  }

Quote:
}



Tue, 31 May 2005 02:51:51 GMT  
 Need some help in writing a simple C program


Quote:
> I have not seen C since 1988 and yesterday, I was given a small
> program to write in C. Being a database guy I am not sure even where
> to begin from. But, last night I tried to put some simple concepts
> together. The requirement is:

> Accept a pointer array.Each element in the pointer array is a record
> that is comma delimited. Take each of these records, parse them out
> and write to an oracle database. I think I can figure out how to write
> to Oracle if I can parse the records out properly.

> Here is what I have so far ... now don't laugh since this is a hack
> and it is based on a day's worth of learning. For now, I just created
> the array locally just to get the code working. I just need to have
> something working very soon. Any help will be appreciated.

> Thanks

> #include <stdio.h>
> #include <string.h>
> #include <string.h>
> #include <stdlib.h>

> int i, k, w,l,m;
> int indx[3];
> char *column;
> char *str;
> char delimiter = ',';

> int str_len (char *s)

you already included string.h, i recommend you use strlen from the
standard library.

Quote:
> char* find_column(char *r,int start,int end)
> {
>     char *tmp = r;
>     char *col;
>     printf("%d %d\n",start,end);
>       while ((*tmp++ = *col++) && ((tmp-r) >=start) && ((tmp -r) <
> end))
>         {
>           ;
>         }
>      return (col);
> }

i am not sure what this function is intended to do. is a column defined
as anything between two commas? you might find strchr from the standard
library useful.

- Show quoted text -

Quote:
> int main(void)
> {
> char *string1[] =
> {"CLB,11.100000,20021211163304","PB,8.860000,20021211163301","STNR,13.1
> 00000,200212111617
> 17","TEM.SM,NoData","FP.FP,NoData","ANA.SM,NoData","UNA.NA,NoData","WVC
> .FP,NoData","MMT,5.810000,2002121116
> 3303","BRM,16.320000,20021211163301"};

> for (i=0;i<10;i++)
>   {
>     w=str_len(string1[i]);
>     char *str = string1[i];
>     k=1;
> /*    printf("%s  %i\n",string1[i],w); */
>     while (*str != '\0')
>       {
>         if ((*str == delimiter) && (*str != '\0'))

strchr would help you simplify this.

Sinan.

--
A. Sinan Unur

Remove dashes for address



Tue, 31 May 2005 02:59:18 GMT  
 Need some help in writing a simple C program


Quote:
> I have not seen C since 1988 and yesterday, I was given a small
> program to write in C. Being a database guy I am not sure even where
> to begin from. But, last night I tried to put some simple concepts
> together. The requirement is:

> #include <stdio.h>
> #include <string.h>
> #include <string.h>

Only need it once :-)

Quote:
> #include <stdlib.h>

> int i, k, w,l,m;

For starters, try to keep variables as tightly scoped as possible. That
is, if these vars. are only used in main() then define them there and only
there. If they need to be used throughout this file but not in any other
file, then define them here but as static int ....


Tue, 31 May 2005 03:01:03 GMT  
 Need some help in writing a simple C program

Quote:

> I have not seen C since 1988 and yesterday, I was given a small
> program to write in C. Being a database guy I am not sure even where
> to begin from. But, last night I tried to put some simple concepts
> together. The requirement is:

> Accept a pointer array.Each element in the pointer array is a record
> that is comma delimited. Take each of these records, parse them out
> and write to an oracle database. I think I can figure out how to write
> to Oracle if I can parse the records out properly.

> Here is what I have so far ... now don't laugh since this is a hack
> and it is based on a day's worth of learning. For now, I just created
> the array locally just to get the code working. I just need to have
> something working very soon. Any help will be appreciated.

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

/**************************************************
 * I don't know if you can change the string or not,
 * so I'm going to assume that you can't, and I
 * will copy it before I parse it. If you know that
 * you can modify the string, then you don't need
 * to copy it. If you don't need to copy, you won't
 * need this function.
 *
 * Note that you really should free any strings
 * returned by this function when you are done with
 * them.
 *************************************************/

static char * bogus_strdup(const char * string)
{
  char *duplicate;
  size_t l = 1 + strlen(string);
  duplicate = malloc(l);
  if (duplicate != NULL)
    memcpy(duplicate, string, l);
  return duplicate;

Quote:
}

/****************************************************
* This function consumes items in a string. It works
* a bit like strtok, but with no state maintained in
* between calls. It finds the next instance of
* delimiter in string, and changes it to a '\0'. If
* the delimiter is not found, NULL is returned. NULL
* is also returned if the character after delimiter
* is '\0'. You may want to change this last bit.
* Please don't let the delimiter be '\0'. (You've been
* warned.)
*****************************************************/
static char *get_next_item(char *string, int delimiter)
{
  char *item;
  item = strchr(string, delimiter);
  if (item != NULL)
  {
    *item='\0';
    item++;
    if ('\0' == item)
      item = NULL;
  }
  return item;

Quote:
}

int main(void)
{
int i;
int delimiter = ',';
char *last_item, *next_item;
char *string1[] = {
    "CLB,11.100000,20021211163304",
    "PB,8.860000,20021211163301",
    "STNR,13.100000,20021211161717",
    "TEM.SM,NoData",
    "FP.FP,NoData",
    "ANA.SM,NoData",
    "UNA.NA,NoData",
    "WVC.FP,NoData",
    "MMT,5.810000,2002121116 3303",
    "BRM,16.320000,20021211163301"

Quote:
};

for (i=0;i<10;i++)
  {
    char *str;
    str = bogus_strdup(string1[i]);
    printf("string %d\n", i);
    if (NULL == str)
      return EXIT_FAILURE; /* need better handling */
    last_item = next_item = str;
    while(next_item != NULL)
      {
        next_item = get_next_item(last_item, delimiter);
        printf("    item: %s\n", last_item);
        last_item=next_item;
      }
    }
return 0;

Quote:
}
> Thanks

[code snipped]
You're welcome!

--Mac



Tue, 31 May 2005 15:04:23 GMT  
 Need some help in writing a simple C program
Thanks all for the input. I will try out these suggestions and if I
need further help, will again post. This is a great learning
experience for me and I am enjoying doing something new.

Thanks once again.

Regards
Harry


Quote:

> > I have not seen C since 1988 and yesterday, I was given a small
> > program to write in C. Being a database guy I am not sure even where
> > to begin from. But, last night I tried to put some simple concepts
> > together. The requirement is:

> > Accept a pointer array.Each element in the pointer array is a record
> > that is comma delimited. Take each of these records, parse them out
> > and write to an oracle database. I think I can figure out how to write
> > to Oracle if I can parse the records out properly.

> > Here is what I have so far ... now don't laugh since this is a hack
> > and it is based on a day's worth of learning. For now, I just created
> > the array locally just to get the code working. I just need to have
> > something working very soon. Any help will be appreciated.

> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>

> /**************************************************
>  * I don't know if you can change the string or not,
>  * so I'm going to assume that you can't, and I
>  * will copy it before I parse it. If you know that
>  * you can modify the string, then you don't need
>  * to copy it. If you don't need to copy, you won't
>  * need this function.
>  *
>  * Note that you really should free any strings
>  * returned by this function when you are done with
>  * them.
>  *************************************************/

> static char * bogus_strdup(const char * string)
> {
>   char *duplicate;
>   size_t l = 1 + strlen(string);
>   duplicate = malloc(l);
>   if (duplicate != NULL)
>     memcpy(duplicate, string, l);
>   return duplicate;
> }

> /****************************************************
> * This function consumes items in a string. It works
> * a bit like strtok, but with no state maintained in
> * between calls. It finds the next instance of
> * delimiter in string, and changes it to a '\0'. If
> * the delimiter is not found, NULL is returned. NULL
> * is also returned if the character after delimiter
> * is '\0'. You may want to change this last bit.
> * Please don't let the delimiter be '\0'. (You've been
> * warned.)
> *****************************************************/
> static char *get_next_item(char *string, int delimiter)
> {
>   char *item;
>   item = strchr(string, delimiter);
>   if (item != NULL)
>   {
>     *item='\0';
>     item++;
>     if ('\0' == item)
>       item = NULL;
>   }
>  return item;
> }

> int main(void)
> {
> int i;
> int delimiter = ',';
> char *last_item, *next_item;
> char *string1[] = {
>     "CLB,11.100000,20021211163304",
>     "PB,8.860000,20021211163301",
>     "STNR,13.100000,20021211161717",
>     "TEM.SM,NoData",
>     "FP.FP,NoData",
>     "ANA.SM,NoData",
>     "UNA.NA,NoData",
>     "WVC.FP,NoData",
>     "MMT,5.810000,2002121116 3303",
>     "BRM,16.320000,20021211163301"
> };

> for (i=0;i<10;i++)
>   {
>     char *str;
>     str = bogus_strdup(string1[i]);
>     printf("string %d\n", i);
>     if (NULL == str)
>       return EXIT_FAILURE; /* need better handling */
>     last_item = next_item = str;
>     while(next_item != NULL)
>       {
>         next_item = get_next_item(last_item, delimiter);
>         printf("    item: %s\n", last_item);
>         last_item=next_item;
>       }
>     }
>  return 0;
> }

> > Thanks

> [code snipped]
> You're welcome!

> --Mac



Tue, 31 May 2005 23:25:04 GMT  
 Need some help in writing a simple C program

Quote:

> Thanks all for the input. I will try out these suggestions and if
> I need further help, will again post. This is a great learning
> experience for me and I am enjoying doing something new.

When you do, PLEASE DON'T TOPPOST.

--

   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!



Wed, 01 Jun 2005 01:21:23 GMT  
 Need some help in writing a simple C program
Dear Harry,

     You need not invent a new bike. There are strtok() and strcpy()
in string.h
which can do all you need. You even don't need strlen().
Please consider the new, enhanced version of your program, which
not only finds all ',' delimited substrings in each of your input
array of strings, but also places them into output char array
out[10][cnt][100], where cnt is a counter of ',' in each of the
input string.
Note: your input data have to be allocated by DS segment
to be easily transferred into Oracle, define them in the static
section
of the C program (in the beginning of the C code, before main() ).

Regards,

Dr. Fairman, Ph.D.

Enhanced help for students on ALL subjects!
http://expert2002.50megs.com/consultant.html

Appendix: New program code:
===begin new code ===
#include <stdio.h>
#include <string.h>

/* this enhanced version uses strtok() and strcpy() from string.h
to do all you need and even more ( placing all ',' delimited
substrings of the each input string into 3-dim array out[][][]. Enloy!
*/

int i,w,t;
/* new */ int cnt[10]; /* =how much ',' in i- string */
/* new */ int j,n;
char *str;

/* new */       char out[10][20][100],*ss;

char *string1[] = {"CLB,11.100000,20021211163304",
"PB,8.860000,20021211163301",
"STNR,13.100000,20021211161717",
"TEM.SM,NoData",
"FP.FP,NoData",
"ANA.SM,NoData",
"UNA.NA,NoData",
"WVC.FP,NoData",
"MMT,5.810000,20021211163303",
"BRM,16.320000,20021211163301,this,enhanced,program,writes,all,tokens,into
the array=out,ENJOY IT!!!"};

int main(void)
{
    for (i=0;i<10;i++)
    {
    str = string1[i];
/*  new code: */
t = 0;
ss = strtok(str,",");
if(ss == NULL)
continue;
strcpy(&out[i][t][0],ss);
  for(;;){
ss = strtok(NULL,",");
if(ss != NULL)
{t++; cnt[i]++;
strcpy(&out[i][t][0],ss); }
else
break;
         }
/* printing out the content of the array "out"  */
for (n = 0 ; n <= cnt[i]; n++)
printf(" \nString number %d substring N = %d: Content =
%s",i,n,out[i][n]);
  }  /* end of "for (i=0;i<10;i++)"  */

Quote:
}

====end new code ===

Quote:

> I have not seen C since 1988 and yesterday, I was given a small
> program to write in C. Being a database guy I am not sure even where
> to begin from. But, last night I tried to put some simple concepts
> together. The requirement is:

> Accept a pointer array.Each element in the pointer array is a record
> that is comma delimited. Take each of these records, parse them out
> and write to an oracle database. I think I can figure out how to write
> to Oracle if I can parse the records out properly.

> Here is what I have so far ... now don't laugh since this is a hack
> and it is based on a day's worth of learning. For now, I just created
> the array locally just to get the code working. I just need to have
> something working very soon. Any help will be appreciated.

> Thanks

> #include <stdio.h>
> #include <string.h>
> #include <string.h>
> #include <stdlib.h>

> int i, k, w,l,m;
> int indx[3];
> char *column;
> char *str;
> char delimiter = ',';

> int str_len (char *s)
> {
>   char *p = s;

>   while (*p != '\0')
>       p++;
>   return p - s;
> }

> char* find_column(char *r,int start,int end)
> {
>     char *tmp = r;
>     char *col;
>     printf("%d %d\n",start,end);
>       while ((*tmp++ = *col++) && ((tmp-r) >=start) && ((tmp -r) <
> end))
>         {
>           ;
>         }
>      return (col);
> }

> int main(void)
> {
> char *string1[] = {"CLB,11.100000,20021211163304","PB,8.860000,20021211163301","STNR,13.100000,200212111617
> 17","TEM.SM,NoData","FP.FP,NoData","ANA.SM,NoData","UNA.NA,NoData","WVC.FP,NoData","MMT,5.810000,2002121116
> 3303","BRM,16.320000,20021211163301"};

> for (i=0;i<10;i++)
>   {
>     w=str_len(string1[i]);
>     char *str = string1[i];
>     k=1;
> /*    printf("%s  %i\n",string1[i],w); */
>     while (*str != '\0')
>       {
>         if ((*str == delimiter) && (*str != '\0'))
>            {
>             indx[k] = str - string1[i];
> /*            printf("%d \n",k); */
>             k++;
>            }
>         str++;
>       }
>     for (l=1;l<k;l++)
>     {
>       printf("%s %d %d  %d\n",string1[i],indx[l-1],indx[l],k);
>       column=find_column (string1[i],indx[l-1],indx[l]);
>     }
>  /*    printf ("FINAL %s\n",*column); */
>   }
> }

--



Wed, 01 Jun 2005 02:46:04 GMT  
 Need some help in writing a simple C program

Quote:

> I have not seen C since 1988 and yesterday, I was given a small
> program to write in C. Being a database guy I am not sure even where
> to begin from. But, last night I tried to put some simple concepts
> together. The requirement is:

> Accept a pointer array.Each element in the pointer array is a record
> that is comma delimited. Take each of these records, parse them out
> and write to an oracle database. I think I can figure out how to write
> to Oracle if I can parse the records out properly.

> Here is what I have so far ... now don't laugh since this is a hack
> and it is based on a day's worth of learning. For now, I just created
> the array locally just to get the code working. I just need to have
> something working very soon. Any help will be appreciated.

Try this:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

/**************************************************
 * I don't know if you can change the string or not,
 * so I'm going to assume that you can't, and I
 * will copy it before I parse it. If you know that
 * you can modify the string, then you don't need
 * to copy it. If you don't need to copy, you won't
 * need this function.
 *
 * Note that you really should free any strings
 * returned by this function when you are done with
 * them.
 *************************************************/

static char * bogus_strdup(const char * string)
{
  char *duplicate;
  size_t l = 1 + strlen(string);
  duplicate = malloc(l);
  if (duplicate != NULL)
    memcpy(duplicate, string, l);
  return duplicate;

Quote:
}

/****************************************************
* This function consumes items in a string. It works
* a bit like strtok, but with no state maintained in
* between calls. It finds the next instance of
* delimiter in string, and changes it to a '\0'. If
* the delimiter is not found, NULL is returned. NULL
* is also returned if the character after delimiter
* is '\0'. You may want to change this last bit.
* Please don't let the delimiter be '\0'. (You've been
* warned.)
*****************************************************/
static char *get_next_item(char *string, int delimiter)
{
  char *item;
  item = strchr(string, delimiter);
  if (item != NULL)
  {
    *item='\0';
    item++;
    if ('\0' == item)
      item = NULL;
  }
  return item;

Quote:
}

int main(void)
{
int i;
int delimiter = ',';
char *last_item, *next_item;
char *string1[] = {
    "CLB,11.100000,20021211163304",
    "PB,8.860000,20021211163301",
    "STNR,13.100000,20021211161717",
    "TEM.SM,NoData",
    "FP.FP,NoData",
    "ANA.SM,NoData",
    "UNA.NA,NoData",
    "WVC.FP,NoData",
    "MMT,5.810000,2002121116 3303",
    "BRM,16.320000,20021211163301"

Quote:
};

for (i=0;i<10;i++)
  {
    char *str;
    str = bogus_strdup(string1[i]);
    printf("string %d\n", i);
    if (NULL == str)
      return EXIT_FAILURE; /* need better handling */
    last_item = next_item = str;
    while(next_item != NULL)
      {
        next_item = get_next_item(last_item, delimiter);
        printf("    item: %s\n", last_item);
        last_item=next_item;
      }
    }
return 0;

Quote:
}
> Thanks

Your welcome.

Hope it helps.

--Mac



Sat, 17 Sep 2005 15:28:52 GMT  
 Need some help in writing a simple C program

Quote:

> I have not seen C since 1988 and yesterday, I was given a small
> program to write in C. Being a database guy I am not sure even where
> to begin from. But, last night I tried to put some simple concepts
> together. The requirement is:

> Accept a pointer array.Each element in the pointer array is a record
> that is comma delimited. Take each of these records, parse them out
> and write to an oracle database. I think I can figure out how to write
> to Oracle if I can parse the records out properly.

> Here is what I have so far ... now don't laugh since this is a hack
> and it is based on a day's worth of learning. For now, I just created
> the array locally just to get the code working. I just need to have
> something working very soon. Any help will be appreciated.

Try this:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

/**************************************************
 * I don't know if you can change the string or not,
 * so I'm going to assume that you can't, and I
 * will copy it before I parse it. If you know that
 * you can modify the string, then you don't need
 * to copy it. If you don't need to copy, you won't
 * need this function.
 *
 * Note that you really should free any strings
 * returned by this function when you are done with
 * them.
 *************************************************/

static char * bogus_strdup(const char * string)
{
  char *duplicate;
  size_t l = 1 + strlen(string);
  duplicate = malloc(l);
  if (duplicate != NULL)
    memcpy(duplicate, string, l);
  return duplicate;

Quote:
}

/****************************************************
* This function consumes items in a string. It works
* a bit like strtok, but with no state maintained in
* between calls. It finds the next instance of
* delimiter in string, and changes it to a '\0'. If
* the delimiter is not found, NULL is returned. NULL
* is also returned if the character after delimiter
* is '\0'. You may want to change this last bit.
* Please don't let the delimiter be '\0'. (You've been
* warned.)
*****************************************************/
static char *get_next_item(char *string, int delimiter)
{
  char *item;
  item = strchr(string, delimiter);
  if (item != NULL)
  {
    *item='\0';
    item++;
    if ('\0' == item)
      item = NULL;
  }
  return item;

Quote:
}

int main(void)
{
int i;
int delimiter = ',';
char *last_item, *next_item;
char *string1[] = {
    "CLB,11.100000,20021211163304",
    "PB,8.860000,20021211163301",
    "STNR,13.100000,20021211161717",
    "TEM.SM,NoData",
    "FP.FP,NoData",
    "ANA.SM,NoData",
    "UNA.NA,NoData",
    "WVC.FP,NoData",
    "MMT,5.810000,2002121116 3303",
    "BRM,16.320000,20021211163301"

Quote:
};

for (i=0;i<10;i++)
  {
    char *str;
    str = bogus_strdup(string1[i]);
    printf("string %d\n", i);
    if (NULL == str)
      return EXIT_FAILURE; /* need better handling */
    last_item = next_item = str;
    while(next_item != NULL)
      {
        next_item = get_next_item(last_item, delimiter);
        printf("    item: %s\n", last_item);
        last_item=next_item;
      }
    }
return 0;

Quote:
}
> Thanks

[code snipped]

You're welcome. I hope it helps!

--Mac



Sat, 17 Sep 2005 15:28:52 GMT  
 Need some help in writing a simple C program

Quote:

> I have not seen C since 1988 and yesterday, I was given a small
> program to write in C. Being a database guy I am not sure even where
> to begin from. But, last night I tried to put some simple concepts
> together. The requirement is:

> Accept a pointer array.Each element in the pointer array is a record
> that is comma delimited. Take each of these records, parse them out
> and write to an oracle database. I think I can figure out how to write
> to Oracle if I can parse the records out properly.

Here is what I did. It's based on the code you posted, but is quite a bit
different. Hope it helps.

I'll sign off here

--Mac

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

/**************************************************
 * I don't know if you can change the string or not,
 * so I'm going to assume that you can't, and I
 * will copy it before I parse it. If you know that
 * you can modify the string, then you don't need
 * to copy it. If you don't need to copy, you won't
 * need this function.
 *
 * Note that you really should free any strings
 * returned by this function when you are done with
 * them.
 *************************************************/

static char * bogus_strdup(const char * string)
{
  char *duplicate;
  size_t l = 1 + strlen(string);
  duplicate = malloc(l);
  if (duplicate != NULL)
    memcpy(duplicate, string, l);
  return duplicate;

Quote:
}

/****************************************************
* This function consumes items in a string. It works
* a bit like strtok, but with no state maintained in
* between calls. It finds the next instance of
* delimiter in string, and changes it to a '\0'. If
* the delimiter is not found, NULL is returned. NULL
* is also returned if the character after delimiter
* is '\0'. You may want to change this last bit.
* Please don't let the delimiter be '\0'. (You've been
* warned.)
*****************************************************/
static char *get_next_item(char *string, int delimiter)
{
  char *item;
  item = strchr(string, delimiter);
  if (item != NULL)
  {
    *item='\0';
    item++;
    if ('\0' == item)
      item = NULL;
  }
  return item;

Quote:
}

int main(void)
{
int i;
int delimiter = ',';
char *last_item, *next_item;
char *string1[] = {
    "CLB,11.100000,20021211163304",
    "PB,8.860000,20021211163301",
    "STNR,13.100000,20021211161717",
    "TEM.SM,NoData",
    "FP.FP,NoData",
    "ANA.SM,NoData",
    "UNA.NA,NoData",
    "WVC.FP,NoData",
    "MMT,5.810000,2002121116 3303",
    "BRM,16.320000,20021211163301"

Quote:
};

for (i=0;i<10;i++)
  {
    char *str;
    str = bogus_strdup(string1[i]);
    printf("string %d\n", i);
    if (NULL == str)
      return EXIT_FAILURE; /* need better handling */
    last_item = next_item = str;
    while(next_item != NULL)
      {
        next_item = get_next_item(last_item, delimiter);
        printf("    item: %s\n", last_item);
        last_item=next_item;
      }
    }
return 0;
Quote:
}



Sat, 17 Sep 2005 15:28:51 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Need some help in writing a simple C program

2. Need Help on simple ISAM like program

3. need help in extremely simple c program

4. need help debugging simple c program

5. Need some help with tweeking a simple program

6. Help on a simple calculator program which needs Trigo, Arithmethic, log functions..[Apologies for repeat mail]

7. Need help with simple C Program

8. Simple BC+31 program - help needed

9. !Need help with simple C program

10. Need Help with a SIMPLE mouse control program in C.

11. Need Help in converting Simple C program to VC

12. Need help with simple dialog program?

 

 
Powered by phpBB® Forum Software