vfprintf on 64-bit environment

Support for the other architectures (X86_64, IA-64, and PowerPC)
Post Reply
Posts: 4
Joined: 2009/06/05 21:55:45

vfprintf on 64-bit environment

Post by saurabhchokshi » 2010/04/14 18:47:24

Hello All,

I want to use vfprintf with the char * on 64-bit. Here is the sample code:

char p[45];
char *p_p;

// some code
// User format string
p_p += 3* sizeof(ULONG);
memcpy(&p_format, p_p , sizeof(void *));

vfprintf(fd, p_format, p_p + sizeof(void *));

In this code, I am getting warning:

passing argument 3 of vfprintf from incompatible pointer type

I have done sizeof(va_list) on 64-bit, and its 24 bytes. I don't know how am I suppose to use the va_list this way.

P.S.: This code works absolutely fine on 32-bit platform.


Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

vfprintf on 64-bit environment

Post by pschaff » 2010/04/16 13:35:38

Is this related to your other [url=https://www.centos.org/modules/newbb/viewtopic.php?topic_id=25792&forum=44&post_id=104680#forumpost104680]programming question[/url] and are you still on CentOS 5.3?

These are not really CentOS-specific questions. Perhaps you need some basic references or tutorials on programming and porting to x86_64. The references at the end of the [url=http://en.wikipedia.org/wiki/X86-64]X86-64 Wikipedia article[/url] might be a good starting place.

Posts: 180
Joined: 2008/03/20 05:19:16
Location: Canada

Re: vfprintf on 64-bit environment

Post by movieman » 2010/04/16 18:42:28

And the compiler seems to be telling you what the problem is, since you're passing a char * to something that's expecting a va_alist. It's too long since I last wrote C to remember how you set up the va_alist properly.

Post Reply

Return to “CentOS 5 - X86_64,s390(x) and PowerPC Support”