LinuXelite
Programmer
Hi!! Im a beginner... look at this:
int main(int argc, char *argv[])
{
char *a;
char *b;
strcpy(a,"abc"
strcpy(b,"def"
strcat(a,b);
printf("%s\n",a)
}
gcc test.c - o test
./test
Segmentation fault.
Why??
Secondo:
void Analiser_Buffer(gchar *buffer) {
guint i;
char *ss;
strcpy(ss,""
for(i = 0; i < strlen(buffer) - 1; i++) {
if ((buffer == 13) && (buffer[i+1]) == 10){
Analiser_Ligne(ss);
strcpy(ss, ""
} else {
strcat(ss, buffer); // WARNING,<--- dont work!
printf("%s",buffer); // SEGFAULT;;; WHY?
printf("%c",buffer); // WORKS!
}
}
Thank you!!
Frank,
int main(int argc, char *argv[])
{
char *a;
char *b;
strcpy(a,"abc"
strcpy(b,"def"
strcat(a,b);
printf("%s\n",a)
}
gcc test.c - o test
./test
Segmentation fault.
Why??
Secondo:
void Analiser_Buffer(gchar *buffer) {
guint i;
char *ss;
strcpy(ss,""
for(i = 0; i < strlen(buffer) - 1; i++) {
if ((buffer == 13) && (buffer[i+1]) == 10){
Analiser_Ligne(ss);
strcpy(ss, ""
} else {
strcat(ss, buffer); // WARNING,<--- dont work!
printf("%s",buffer); // SEGFAULT;;; WHY?
printf("%c",buffer); // WORKS!
}
}
Thank you!!
Frank,