Page 1 of 1

IDOS->Printf output not the same as printf

Posted: Mon Jan 07, 2013 1:27 am
by my_pc_is_amiga
This is likely a very basic question --- but I'm not getting the same output when I use the IDOS->Printf versus printf. See below. It looks like the pointers are not getting assigned correctly with the DOS function. Is this due to the 64-bit alignment issue?

----------------------------
CONST_STRPTR teststring = "mystring";

IDOS->Printf("%s -%p- -%c- -%p- -%c- end\n",teststring,teststring,*teststring,teststring+1,*(teststring+1));
printf("%s -%p- -%c- -%p- -%c- end\n",teststring,teststring,*teststring,teststring+1,*(teststring+1));

--------------------------

OUTPUT
mystring -0x3e607080- -- -0x006d3e60- -- end
mystring -0x3e607080- -m- -0x3e607081- -y- end

Re: IDOS->Printf output not the same as printf

Posted: Mon Jan 07, 2013 1:44 am
by colinw
All arguments to Printf() are 32 bit minimum width, (VARARGS68K), your format string must specifiy them that way.
ie; %ld instead of %d - %lc instead of %c - etc...

Please review the DOS Printf() / VPrintf() / VFPrintf() autodocs.

Re: IDOS->Printf output not the same as printf

Posted: Mon Jan 07, 2013 5:53 am
by my_pc_is_amiga
Thanks for the quick response and clarifications!