Hi,

i have the following code not able get the output

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

#define DELIMITER ","



int main()
{
    char *bufferPtr = " \"Angelin\",\"rajeesha\"";
    char *delimiterPtr =NULL;
    int parseIndex = 0;
    char ** fieldarray;
    fieldarray[parseIndex] = bufferPtr;
    parseIndex++ ;
    delimiterPtr = (char *)strstr(bufferPtr, DELIMITER);
    printf("\n delimiterPtr %s\n",delimiterPtr);
     bufferPtr = delimiterPtr + strlen(DELIMITER);
     printf("\n bufferPtr %s\n",bufferPtr);


    return 0;

}

Before you can use fieldarray you have to allocate memory for it. For example:

// allocate enough room to store two pointers
filearray = malloc(2 * sizeof(char*));
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.