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");
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.
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