Re: [gmime-devel] Need code snippet for MIME decoding



On 2/20/2013 6:38 AM, prasad antony wrote:
Hi Jeff,

I am facing one more issue with this program. In this program datatype of variable "name" is const char *. Once we access the file name in to this variable we are opening a file with the same name on the current directory and dumping the content. "name = g_mime_part_get_filename ((GMimePart *) part);" and fd=open(name,....)

 If I want to change the location in which I should get the content what needs to be done?

const char *name = g_mime_part_get_filename ((GMimePart *) part);
char *path = g_build_filename ("/full/path/to", name);
int fd = open (path, ...);
g_free (path);

Reason I am asking is I already wrote the program to define my own location and append this file name with that location so that I can open this file on that location.

How did you do this?

But by accessing the variable "name" it is giving segmentation fault.

Sounds like you somehow corrupted the memory pointed to by name. Did you free() it? Don't.

Even if I do a strlen(name) after the line "name = g_mime_part_get_filename ((GMimePart *) part); , it is giving segmentation fault. Why I am not able to do operations with this variable? But I am able to open file with this name. Can you please help....

I don't know, do you have a code snippet to show what you did?

Jeff



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]