Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Software Development
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard mouse network printer problem ram registry repair router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
C++ Programming Troubles =/ all nighter college assignment please help

Reply  
Thread Tools
Specialk9984's Avatar
Junior Member with 2 posts.
 
Join Date: Sep 2006
29-Sep-2006, 06:18 AM #1
Exclamation C++ Programming Troubles =/ all nighter college assignment please help
Welp, been working on this program off and on for about a week now and still getting errors...

void Population::setName(string zor)
{
strcpy(name, zor);
}

here's were my main problem is... I have a class "Population" in which I declare a private variable called "name" of the string type... welp to this method setName I send another string... I want to copy what i send to the setName method from zor into name... i figured this strcpy would work but apparently it doesnt.

and yes i have to use strings =/ teacher's orders... i probably wouldnt be able to do this with char arrays anyways been coding for several hours straight.. hopefully one of yall has a suggestion
covert215's Avatar
Account Disabled with 2,651 posts.
 
Join Date: Apr 2006
Experience: Web Designer
29-Sep-2006, 08:20 AM #2
move this one to development
GCDude's Avatar
Senior Member with 400 posts.
 
Join Date: Apr 2005
Location: Brighton, UK
Experience: Possibly Competent
29-Sep-2006, 11:05 AM #3
strcpy copies char arrays, it wont work for string type, just assing it.

void Population::setName(string zor)
{
name = zor;
}
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:55 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.