Re: What's wrong ?? LNK2019 error (Unresolved externals)
From: David Olsen (qg4h9ykc5m_at_yahoo.com)
Date: 07/29/04
- Next message: Vladimir Kouznetsov: "Re: Internal Compiler Error"
- Previous message: Ed A: "asynchronous events"
- Maybe in reply to: Fireangel: "Re: What's wrong ?? LNK2019 error (Unresolved externals)"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 29 Jul 2004 11:58:04 -0700
Jason Jacob wrote:
> But another question, as from my code, I have set the cInput (char
> array) to only a length of 10, but how come I can enter a string of
> more than 20 or even 40 characters ?? (It looks quite illogical, but
> somehow it works fine till now)
You are overflowing the buffer and stomping on memory you don't own.
Don't do that!!! Really bad things can happen. You are just unlucky
that it seems to have worked so far.
In today's C++, you should never use char arrays to manipulate strings.
Doing so can be really tedious, and it's just too easy to forget how big
your buffer is and write past the end of it. Always use a string class
instead. I prefer std::string, but any class, even CString, is better
than using char arrays.
-- David Olsen qg4h9ykc5m@yahoo.com
- Next message: Vladimir Kouznetsov: "Re: Internal Compiler Error"
- Previous message: Ed A: "asynchronous events"
- Maybe in reply to: Fireangel: "Re: What's wrong ?? LNK2019 error (Unresolved externals)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|