[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Brug af lib g2 og headers i c++ cgi-script



On Wednesday 28 January 2004 18:45, you wrote:
> On Wed, 2004-01-28 at 15:14, Jan KC wrote:
> > Hej sslug
> >
> > Jeg er ved at lave et c++ cgi-script.
>
> [SNIP]
>
> Nu er det jo sådan et det er noget nemmere at finde fejl
> hvis man rent faktisk kan se hvad du laver.
> Måske lidt sourcekode kunne hjælpe her ?
>
> /Jimmy


Hej igen

Nu har jeg fået kogt lidt source-kode ned så det er til at se hvad
der foregår:

------------------------source_start------------------------------
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <g2.h>
#include <g2_gd.h>
#include <mysql.h>

MYSQL* mysql_handle=mysql_init(NULL);        // ?

int main(void)
  {
   printf("Content-type:text/html\n\n");
   printf("<html>\n");
   printf("<body>\n");
   printf("Testline A .... ok !!!!!!\n");

   // ####################
   int id=g2_open_gd("graph.png",200,200,g2_gd_png);
   int black = g2_ink(id,0,0,0);
   int green = g2_ink(id,0,1,0);
   g2_pen(id,black); 
   g2_filled_rectangle(id,0,0,199,199);
   g2_pen(id,green);
   g2_filled_circle(id,100,100,20);
   g2_line(id,10,10,90,90);                               // ?

   g2_flush(id);
   g2_close(id);
   // ####################

   printf("Testline B .... ok !!!!!!\n");
   printf("</body>\n");
   printf("</html>\n");

   return 0;
  }
------------------------source_slut-------------------------------

Når ovenstående er kompileret og bliver kørt enten via apache
eller bare i konsollen, går computeren  tilsyneladende ind
i en eller anden uendelig løkke og sluger cpukraften.

Når kørt via apache skrives i error.log:
[error] [client 10.0.0.2] Premature end of script headers

Problemet opstår ved linien:
   g2_line(id,10,10,90,90); 
Hvis den udkommenteres er der ingen problemer.

Hvis jeg derimod udelader initialisering af mysql handle:
   MYSQL* mysql_handle=mysql_init(NULL); 
kan jeg godt medtage linien:
   g2_line(id,10,10,90,90); 
og programmet bliver kørt uden problemer.

Hvad går der galt ?

Mange tak for eventuelle svar !


		Venlig hilsen Jan Kirk Christensen





 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *