![]() |
printf problem
Hi,
I am trying to print the examples in the printf_lib.c commented examples. I initialized the variables as directed and then called the following each second. Code:
printf("%s\n",StrPtr); //will display 'Hello world!'Code:
HRegards, ChuckB |
Re: printf problem
Quote:
IFI's implementation of printf doesn't do all the control codes that the PC versions use. But the code given is copied from printf_lib.c (lines 19 through 27) It looks like it's loosing characters, either totally or just garbled. They come through interminently, but when they come in they are intact. (a baud-rate mismatch usually results in framing errors, garbage, and/or extra/lost bytes) When I can get the config dialog fixed, I'll upload Comm Test to my site (to http://endeavour.zapto.org/astro73/programs/). The version that is up at the moment is broken. |
Re: printf problem
What type of computer are you using, and what type of connection to the RC?
|
Re: printf problem
Quote:
to the desired type. If x is an int, y is a int, and z is a long, use: printf("%d %d %lx\n", (int)x, (int)y, (long)z); The default way in which arguments are pushed, for routines that do not have their arguments declared, is char. This is a property of the MicroChip C-Bot compiler enironment. You may influence this behavior by changing settings, but who knows what else will break if you do that. The only place the problem seems to appear is the printf calls, because the arguments for all the other routines are explicitly declared. It is not hard to provide the required type casts to the printf calls. The fact that you can't print a long using the provided printf() is quite a bother. If you would like a routine that addresses that problem, refer to the file pl.c available in the EiC.zip file available in the technical page at www.srvhsrobotics.org The code involved is described in the programming tutorial (well, perhaps not quite a tutorial) available from the same web page. Eugene |
Re: printf problem
Quote:
|
| All times are GMT -5. The time now is 20:01. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi