This is the mail archive of the
mailing list for the GCC project.
Re: What this error code means?
- From: ArtÅras Moskvinas <arturas dot moskvinas at gmail dot com>
- To: "Naga Priya .K" <naga dot priya at accord-soft dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 09 Nov 2006 10:17:57 +0200
- Subject: Re: What this error code means?
- References: <4552C980.email@example.com>
> I`ve written the following C code(Program is in attachment) to find a
> substring from the given string and replace it with the given string. I
> compiled it in Turbo cpp it worked fine and i got the result.
> When i used the same in GCC. It compiles successfully but while
> executing it gives the following result.
> "Tool completed with exit code -1073741819"
> What does this mean?
> What do i have to do it run successfully?
> char *text="This is the sentence from here";
> char *find="from";
> char *replace_with="to";
I'm not an expert, but compiler puts "This is the sentence from here"
into read only memory and then you are trying to modify it, so your OS
terminates your program, it is not allowed to modify read only memory
So the quick fix:
char text[sizeof("This is the sentence from here")];
strcpy(text, "This is the sentence from here");