Mar 8, 2010 at 12:06am UTC
I need to insert and read Arquier, can anyone help with my code?
# Include
# Include <malloc.h>
# Include
# Include <ctype.h>
# Include <fstream.h>
# Include "CGI.h"
struct student {
char ra [10];
char name [40];
char end [40];
char phone [20];
};
int main ()
{
Cgi IGCC;
Item CCGIItem;
char * field;
char * value;
char * tamanhoConteudo = getenv ( "CONTENT_LENGTH");
int i, tamValor, tamNome;
court << "Content-Type: text / html" <<endl <<endl
<< "<html>" <<Endl
<< "<body>" <<Endl
<< "You sent <p>" <<tamanhoConteudo
<< "Bytes of data, containing the following data: </ p>" <<endl
<< "<ul>" <<Endl;
alu student;
cgi.load ();
for (i = 0; i <cgi.GetItemCount (); i + +)
{
cgi.GetItem (i, & item);
tamCampo = item.GetNameLength ();
field = (char *) malloc (tamCampo);
field (item.getName, tamCampo);
court << "<li>" <<area << "-";
tamValor = item.GetLength ();
value = (char *) malloc tamValor ();
(value item.GetValue, tamValor);
court <<value <<endl;
if (strcmp (field, "Rausu") == 0)
{
strcpy alu.ra (, value);
}
if (field == nomeUsu)
{
value == alu.nome;
}
if (field == endUsu)
{
alu.end = value;
}
if (field == telUsu)
{
alu.tel = value;
name (free);
value (free);
/ / End for
}
{
FILE * arq;
arq = fopen ( "teste.file", "ab");
if (file)
{
court << "Error opening file";
}
Else
{
ren fwrite (&, sizeof (student), 1, file);
fclose (arq);
court << "</ ul>" <<endl
<< "</ Body>" <<endl
<< "</ Html>" <<endl;
}
}