#define E_IO_COULDNT_OPEN - 1 #define E_IO_ERRO -2 #define uchar unsigned char *
int LoadFileContent(uchar *path, uchar ** value, long * len) { #define Buffsize 1024*4 int n; long i=0; FILE *file; unsigned char buff[Buffsize]; if ( (file=fopen(path,"rb"))==0) { return E_IO_COULDNT_OPEN; } *value = malloc(Buffsize); *len = 0; fseek(file,0L,SEEK_SET); while ( (n=fread(buff,Buffsize,1,file)) > 0) { if (i>0) *value = realloc(*value, (i+1) * Buffsize); memcpy(*value + (i * Buffsize), buff, Buffsize); *len += n; i++; } if (n==-1) { fclose(file); return E_IO_ERRO; } fclose(file); return 0; } uchar * value; char *query; long len; if ( LoadFileContent("file.jpeg",&value, &len) != 0) exit(); query = sqlite3_mprintf("INSERT INTO blob VALUES('%Q') ", value); /* here i have a segmentation fault! */ /****************** Here I compile in debug mode there segmentation fault is here *****/ sqlite3/printf.c LINE 608 for(i=n=0; (ch=escarg[i])!=0; i++){ escarg is NULL; I know that is not an SQLite bug. I know that that is my fault. Thanks. -- Cesar Rodas http://www.sf.net/projects/pagerank (The PageRank made easy...) http://www.sf.net/projects/fastfs ( The Fast File System) Mobile Phone: 595 961 974165 Phone: 595 21 645590 [EMAIL PROTECTED] [EMAIL PROTECTED]