Oct. 15th, 2002

alexpgp: (Default)
The paper chase continues. I had an illuminating conversation with my new CPA. There is light at the end of the tunnel. I just have to make sure I get everything done by the end of the month.

Period.

End of paragraph.

* * *
As I was drifting off to sleep last night, I figured out what I needed to do to send a 16-bit integer (unsigned) to stdout one byte at a time:

unsigned int target = 0xfeff;
unsigned char *uc = ⌖
fputc(*uc++, stdout);
fputc(*uc, stdout);


It does the job. Hooray.

Now I am faced with another problem. Apparently, when I fputc() a carriage return character (0x0d), a linefeed is added (by the Microsoft OS?) automagically, or maybe not. In any event, when I try to output 0x000d to stdout, I see the following sequence in the file:

0x0d 0x0a 0x00

instead of:

0x0d 0x00 0x0a 0x00

The original file, like any good DOS text file, has embedded carriage returns followed by line feeds, which befuddles me further.

Hypothesis: when I call fgetc(stdin), if the read character is a carriage return, the following linefeed is ignored. If I write that character, then a following linefeed is appended.

I may have to go over to writing the output as a binary file, methinks.

Cheers...

Profile

alexpgp: (Default)
alexpgp

January 2018

S M T W T F S
  1 2 3456
7 8910111213
14 15 16 17181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 13th, 2025 08:26 am
Powered by Dreamwidth Studios