List:General Discussion« Previous MessageNext Message »
From:Pooly Date:March 15 2006 8:51am
Subject:Re: insert my_ulonglong data with C API
View as plain text  
Hi,


2006/3/15, 古雷 <leig@stripped>:
> Thanks a lot!
> But my test is not successful. Please help me.
> This is my test code:
>
> #ifdef WIN32
> #include <windows.h>
> #endif
>
> #include "mysql.h"
> #include <stdio.h>
> main()
> {
>  union ull {
>   unsigned char a[8];
>   my_ulonglong id;
>  } ull;
>  for(int i=0;i<8;i++) ull.a[i]=(unsigned char)255;
>
>  char s[200];
>  sprintf(s,"%llu\n",ull.id);
>  printf("%s\n",s);
>
>  return 0;
> }
>
> On Windows its output is:
> 4294967295
> It's still a 4bytes integer.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_format_specification_fields_.2d_.printf_and_wprintf_functions.asp
try :
sprintf(s,"%I64d\n",ull.id);


--
Pooly
Webzine Rock : http://www.w-fenec.org/
Thread
insert my_ulonglong data with C API古雷15 Mar
  • Re: insert my_ulonglong data with C APIDan Nelson15 Mar
  • Re: insert my_ulonglong data with C API古雷15 Mar
    • Re: insert my_ulonglong data with C APIPooly15 Mar
    • Re: insert my_ulonglong data with C APIDan Nelson15 Mar
  • Re: insert my_ulonglong data with C API古雷16 Mar