title: How to generate an image using C code
body: <p>The function below simply serves html when it is called, however </p>
  
  <pre><code>void generateHTML (int socket) {
     char* message;
  
     // Sends HTTP response header
  
     message = "HTTP/1.0 200 OK\r\n"
                  "Content-Type: text/html\r\n"
                  "\r\n";
     printf ("about to send=&gt; %s\n", message);
     write (socket, message, strlen (message));
  
     message = "&lt;HTML&gt;&lt;BODY&gt;&lt;P&gt;Hello World.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;\n";
     printf ("about to send=&gt; %s\n", message);
     write (socket, message, strlen (message));   
  }
  </code></pre>
  
  <p>My output on the web browser would by a simple Hello World message. However, I want to change it so that it will display a bitmap image instead. Let's use a 1x1 red pixel as our bmp.</p>
  
  <p>I've modified this function so far by:</p>
  
  <pre><code>void generateHTML (int socket) {
     char* message;
  
     // Sends HTTP response header
  
     message = "HTTP/1.0 200 OK\r\n"
                  "Content-Type: image/bmp\r\n"
                  "Content-Length: ???WTF???\r\n";
     printf ("about to send=&gt; %s\n", message);
     write (socket, message, strlen (message));
  
     message = "BMF8\n";
     printf ("about to send=&gt; %s\n", message);
     write (socket, message, strlen (message));   
  
     message = " "; //bmp file data goes here.
     printf ("about to send=&gt; %s\n", message);
     write (socket, message, strlen (message));   
  }
  </code></pre>
  
  <p>Quoting from Dan's answer, the data in hex looks like:</p>
  
  <pre><code>0000000: 424d 3a00 0000 0000 0000 3600 0000 2800  BM:.......6...(.
  0000010: 0000 0100 0000 0100 0000 0100 1800 0000  ................
  0000020: 0000 0400 0000 130b 0000 130b 0000 0000  ................
  0000030: 0000 0000 0000 0000 0000                 ..........
  </code></pre>
  
  <p>However, I simply cannot place that inside the quotation marks. How would I do this?</p>