Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.programming > #223
| From | JohnF <john@please.see.sig.for.email.com> |
|---|---|
| Newsgroups | comp.lang.c, comp.programming |
| Subject | Re: [OT] a server http |
| Date | 2011-04-13 11:14 +0000 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Message-ID | <io40ik$nsi$1@reader1.panix.com> (permalink) |
| References | <4d7f9ac1$0$1353$4fafbaef@reader2.news.tin.it> |
Cross-posted to 2 groups.
In comp.lang.c io_x <a@b.c.invalid> wrote: > why my little http server > is ok for send the right file eg. file.htm > but is not ok in send the file image.gif > > in other words, it can import the file > and not import the gif image in that page. Is it compiled for windows? And are you writing file.htm and image.gif to stdout? I had the same problem with my own little server <www.forkosh.com/mimetex.html> getting it to run on windows (in addition to linux). And you found the problem yourself mentioning \n in one of your followup posts. In windows, stdout is ascii, not binary. You have to #include <fcntl.h> and #include <io.h>, and then issue a _setmode(_fileno(stdout),O_BINARY) to make it binary for windows. Otherwise windows gives you the "newline problem", i.e., every time your gif image happens to contain a byte that's a carriage return, windows will tack on an extra linefeed for you. And that'll totally mess up your gif. -- John Forkosh ( mailto: j@f.com where j=john and f=forkosh )
Back to comp.programming | Previous | Next — Next in thread | Find similar
Re: [OT] a server http JohnF <john@please.see.sig.for.email.com> - 2011-04-13 11:14 +0000 Re: [OT] a server http "io_x" <a@b.c.invalid> - 2011-04-13 16:06 +0200
csiph-web