char ** to char array

Hi i have attached a part of my program below. Here i'm using a function
int FileWrite(int fh, char *buf, int len).
The buf is a char array. I want to store the contents from azColName to the char array buf so that i can use it in the function.

Need help to type cast from char ** to char array.

Here is the part of my program

static int callback(void *NotUsed, int argc, char **argv, char **azColName)
{
int i;
char buf[30];
int FileHandle;
FileHandle = FileCreate("tab.txt");
FileHandle = FileOpen("tab.txt");

for(i=0; i<argc; i++)
{

buf[i] = azColName[i];
FileWrite(FileHandle,buf, 30);

}
FileClose(FileHandle);
return 0;
}

I'm getting this error "error C2440: '=' : cannot convert from 'char *' to 'char'"
Why do you want to cast from
char ** to char array
?

I think the problem is in this line:
buf[i] = azColName[i];

What are you trying to do here? buf contains char (it's a char array).
azColName on the other hand is of type char ** meaning an pointer to a pointer of char. This (maybe) means that it's an array of pointers to char, so maybe 2d array. I cannot really tell since only its type is known. But sure it's distinct than buf type;

Maybe you meant:
buf = azColName[i];
I cannot really tell.
Is there any way that i can pass the values from azColName[i] to be written in a file using FileWrite(int fh, char *buf, int len)?

Because, this is the only function in DragonFireSDK through which i can write to a file.

Thanks!
You must pass the arguments according to your prototype:
FileWrite(int fh, char *buf, int len)

You didn't try to figure out the error. Where is it located this error? In which line?
I guess it's possible to write to a file using this function but you must follow the rules.

Also please try [code][/code] brackets for placing code. It's the first button at your right
Topic archived. No new replies allowed.