Please post the code you have so far...
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
How do you clear a string in a single statement ?
for egs. i want to clear name[20] of all its contents and leave it completely empty
char name[20];
memset(name, 0, sizeof name);
Although typically clearing all elements of a string is unnecessary.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
You should have posted the code for the others you have tried and the error messages or problems you encountered. The problem is unlikely to be with their code but rather how you typed it in or if you're using the outdated version of turbo c, which is probably very likely :)
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
Personally, anything with the word turbo c in makes me cringe, although admittedly the latest version is supposed to confirm to the standard, so it is actually ok to use.
But I'd recommend using dev-cpp. It's a small download at only 10MB and comes with loads of options, open-gl, native win32 GUI support for windows etc.
You can get it here:
http://www.bloodshed.net/devcpp.html
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
The problem is unlikely to be with their code but rather ... you're using the outdated version of turbo c, which is probably very likely :)
So you claim that theoutdated versions of C/C++, like Turbo, never handled strings correctly? :icon_rolleyes: Or is it that after new versions came out, the older versions simply wore out and developed bugs?
If you're going to continue to slam older compilers, at least use reasons that make sense...
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
So you claim that the outdated versions of C/C++, like Turbo, never handled strings correctly? :icon_rolleyes: Or is it that after new versions came out, the older versions simply wore out and developed bugs?
If you're going to continue to slam older compilers, at least use reasons that make sense...
A slant I took on this is that the std namespace didn't exist and as such standard C++ is not supported. That is, there was no std::string , so using standard strings in an outdated compiler may have proved problematic. YMMV.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
Dave, at least you have a viable reason. Most other reasons I see given here is simply because it's old. Not a valid reason IMAO.
My preference would be to stop telling people "your compiler's old, so upgrade to [my personal favorite] compiler." If that's what they are using, let them use it unless it's really crap (like Digital Mars).
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944