Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

185
Vistas
getenv(QUERY_STRING) Devolviendo NULL

Actualmente estoy tratando de hacer un programa CGI simple que genere la entrada de alguien en C. Curiosamente, la variable de entorno "QUERY_STRING" está devolviendo nulo. Aquí está el código que tengo, dos archivos simples, uno .html y otro .c.

simple.c

 #include <stdio.h> #include <stdlib.h> void openHTML(char* path); int main(){ printf("Content-Type: text/html \n\n"); openHTML("simple.html"); char* data; data = getenv("QUERY_STRING"); printf("Data: %s", data); return 0; } void openHTML(char* path){ //Opens File FILE* file = fopen(path, "r"); //Reads through lines char line[256]; while (fgets(line, sizeof(line), file)) { printf("%s", line); } fclose(file); }

simple.html

 <html> <body> <form action="http://localhost/cgi-bin/simple.exe" method="post"> <label for="fname">First name:</label> <input type="text" id="fname" name="fname"><br><br> <label for="lname">Last name:</label> <input type="text" id="lname" name="lname"><br><br> <input type="submit" value="Submit"> </form> </body> </html>

Salida de corriente:

 Content-Type: text/html <html> <body> <form action="http://localhost/cgi-bin/simple.exe" method="post"> <label for="fname">First name:</label> <input type="text" id="fname" name="fname"><br><br> <label for="lname">Last name:</label> <input type="text" id="lname" name="lname"><br><br> <input type="submit" value="Submit"> </form> </body> </html> Data: (null)
over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda