Mail Archives: djgpp/2000/03/25/16:13:24
I have this strange (strange to me) problem with one of my C programs
the frist time I run it It works just as I want it to, but anytime after that
it prints a bunch of junk on the screen like:
Exiting to due to signal SIGSEGV
General Production Fault at eip=00002ff3
and then a bunch of stuff that looks like Asm resters and stuff
If I reboot, then I can run the program once without this happaning but then it
happans again, i don't get it, Please help, Here is my code
/* Pad.c */
#include <stdio.h>
#include <string.h>
main()
{
char Text[20][81], CharTemp;
int Count,Counter,Temp, i;
for( i = 0; i <=20; i++)
strcpy(Text[i], "");
puts("This will \"pad\" your lines");
puts("Type quit on a newline to exit");
do
{
Count++;
printf(">");
gets(Text[Count]);
} while( strcmp("quit",Text[Count]) != 0 );
for( Counter = 0; Counter <= Count; Counter++ )
if( strlen(Text[Counter]) < 70)
for( Temp = strlen( Text[Counter] ); Temp <= 70; Temp++ )
strcat(Text[Counter],".");
for( Counter = 0; Counter <= 20; Counter++ )
printf("\n%s",Text[Counter]);
}
- Raw text -