"Robbie Hatley" <> wrote in message
news: ...
>
> "bartc" wrote:
>
>> What happens when you leave out the "\n"?
>>
>> What about just doing printf ("abc\ndef\n"); ?
>>
>> Or puts("abc"); puts("def"); ?
> Ok, I'll test those. Here's a simple program:
> printf("abcd");
> printf("efgh");
> printf("ijkl");
....
> OUTPUT:
>
> abcdefghijkl
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> abc
> def
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> abc
> def
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> printf() isn't automatically inserting newlines.
> I didn't think it would, as other programs I've written
> and compiled on same compiler don't put them in.
OK, so printf() works as it should. So now, starting either with a simple,
working printf and adding to it, or the other way, try and see where the
problem creeps in.
These are suggestions (or perhaps put all of them in the loop; after which
one is there an extra newline?):
printf("<>\n");
printf("<%d>\n", (int)Fahr);
printf("<%10d>\n", (int)Fahr);
printf("<%10.3f>\n", Fahr);
printf("<%10.3f %10.3f>\n", Fahr, Cels);
Then that might give a clue as to what's causing the problem (as I can't
recreate it). Maybe a hidden control character in the format string (I
didn't notice one)?
--
Bartc
|