L
Lampa Dario
Hi, where is this stupid error in this program? When I execute it, i
receive a segmentation fault error.
#include <stdio.h>
int main(int argc, char *argv[], char *env[]) { int i=0; int l=0;
int word=0;
char *querystring;
querystring=malloc(sizeof(char)*100000);
if (getenv("QUERY_STRING")==NULL)
strcpy(querystring,"QUERY_STRING\0");
else
strcpy(querystring,(char *) getenv("QUERY_STRING"));
//l=strlen((char *)getenv("QUERY_STRING"));
//printf("%d \n",l);
//strcpy(querystring,(char *) getenv("QUERY_STRING"));
i=0;word=0;
printf("Stampa di QUERY_STRING\n");
//printf("QUERY_STRING=%s\n",querystring);
//while (querystring!='\0')
//{
//printf("Parola %d",word++);
//while (querystring!='&')
//{
//printf("%c",querystring);
//i++;
//}
//i++;
//}
}
Francesco
receive a segmentation fault error.
#include <stdio.h>
int main(int argc, char *argv[], char *env[]) { int i=0; int l=0;
int word=0;
char *querystring;
querystring=malloc(sizeof(char)*100000);
if (getenv("QUERY_STRING")==NULL)
strcpy(querystring,"QUERY_STRING\0");
else
strcpy(querystring,(char *) getenv("QUERY_STRING"));
//l=strlen((char *)getenv("QUERY_STRING"));
//printf("%d \n",l);
//strcpy(querystring,(char *) getenv("QUERY_STRING"));
i=0;word=0;
printf("Stampa di QUERY_STRING\n");
//printf("QUERY_STRING=%s\n",querystring);
//while (querystring!='\0')
//{
//printf("Parola %d",word++);
//while (querystring!='&')
//{
//printf("%c",querystring);
//i++;
//}
//i++;
//}
}
Francesco