Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #223 > unrolled thread
| Started by | JohnF <john@please.see.sig.for.email.com> |
|---|---|
| First post | 2011-04-13 11:14 +0000 |
| Last post | 2011-04-13 16:06 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.programming
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
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
| From | JohnF <john@please.see.sig.for.email.com> |
|---|---|
| Date | 2011-04-13 11:14 +0000 |
| Subject | Re: [OT] a server http |
| Message-ID | <io40ik$nsi$1@reader1.panix.com> |
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 )
[toc] | [next] | [standalone]
| From | "io_x" <a@b.c.invalid> |
|---|---|
| Date | 2011-04-13 16:06 +0200 |
| Message-ID | <4da5adc9$0$38644$4fafbaef@reader1.news.tin.it> |
| In reply to | #223 |
"JohnF" <> ha scritto nel messaggio news:io40ik$nsi$1@reader1.panix.com... > 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. all ok, the problem was for the program that wrote .htm the page. i consieder all file binary, i wrote all routines for input-output from OS to all i can imagine...
[toc] | [prev] | [standalone]
Back to top | Article view | comp.programming
csiph-web