Re: [gmime-devel] Need code snippet for MIME decoding
From: Jeffrey Stedfast <fejj gnome org>
To: prasad antony <prasadantonymad gmail com>
Cc: gmime-devel-list gnome org
Subject: Re: [gmime-devel] Need code snippet for MIME decoding
Date: Thu, 21 Feb 2013 07:00:48 -0500
Hi Prassad,
It's possible that g_mime_part_get_filename() is returning null.
It's not guaranteed to find a filename parameter and so in those
cases will return null.
Hope that helps,
Jeff
On 2/21/2013 6:45 AM, prasad antony wrote:
Hi Jeff,
i think the issue is resolved. It could be because
of some memory issues here. Sorry for the trouble. Let me see
more on this.
I can do this even without temp variable.
strcat(tempfile,name). While accessing the variable
name to standard C functions it is giving segmentation
fault.
In parallel let me try with your suggestion to do
it with gmime APIs....But I would like to understand
why the segmentation fault with my code....
Thanks so much Jeff for your quick reply....
Thanks
Prasad.
On Thu, Feb 21, 2013 at 6:26
AM, Jeffrey Stedfast <fejj gnome org>
wrote:
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?
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?