"Gaurav" <> wrote in message
news: oups.com...
> Hi All,
>
> I have written the 'c' code for specific purpose and tested it over
> many files and it is crashing in only one case.
You do know this is a C++ newsgroup, not a C newsgroup, right?
I'm not sure what you mean when you say you "tested it over many files".
Are you talking about some kind of input data file your program reads?
> When I ran the same
> code in the debug mode within the VS against the same file it works
> well and it also works well in the release mode with in the VS. It get
> crashed only when I run it from the console.
>
> I have checked my code against the heap correction and memory leaks and
> its perfectly fine. I have tried every option and none of them is
> working and also if I put up some printf in my code, it start working
> from the console mode.
>
> In short, this is a bouncer for me.
"bouncer"?
>
> Does any one have some ideas how the working of the exe is different
> when we ran it from the VS as comapred to console. or the points whihc
> i should consider regarding my code?
>
Given that you said it works if you add in printf statements, then a highly
likely cause is that you're overwriting a buffer (i.e., assigning values to
positions past the end of an array). Check if your code contains any
arrays, and make sure that there is no way your code can write past the end
(including C-string-related code which may tack on a NULL-terminator behind
the scenes).
It could be that the file which exhibits the problem has data in it which
isn't the expected format. For example, you might be expecting CR/LF line
terminators, but it contains only CR terminators, or none at all. Or some
line in the file may be one character longer than you expect. Or you may be
expecting it to be pure ASCII, but it contains a non-ASCII character
somewhere.
Of course, without seeing any code, it's impossible for us to tell if you've
got a logic or coding error somewhere.
-Howard