passing a string to a C++ function



here's a very simple process:


//
char outputstring()
{

char *items[6]={"tom","paul","joseph"};
int size;
int count;

size = sizeof(items)/sizeof(float);

//print arra elements
for ( count = 0; count < size; count++ )
{
if (items[count]!=NULL)
{
printf ("%s\n", items[count]);
}

}



return 0;

}

what I would like to do is pass a string to this function and put that
string into the *items array pointer....

so something like this:

char outputstring(char *items1)
{

char *items[6]={items1};
int size;
int count;

size = sizeof(items)/sizeof(float);



for ( count = 0; count < size; count++ )
{
if (items[count]!=NULL)
{
printf ("%s\n", items[count]);
}
}



return 0;

}
I am not sure if the above is right.

now say I have a file with the following items

"jam"
"cookies"
"flour"
"bread"

I would like to have this program read the file (I can do the part of
opening the file), but I am not sure how to put the items in a string ready
for the array.
Or as in my case have the string passed to the function from a VB wrapper
but in a form that would be properly inserted into my array. Items can vary
in number

Thanks a lot for any help

Leo




.



Relevant Pages