Thread: HELP!! strcpy

  1. #1
    Registered User abbynormal87's Avatar
    Join Date
    Apr 2002
    Posts
    17

    Question HELP!! strcpy

    i'm haveing trouble with my program:

    for ( int i = 0; i < divmax; i++ )
    {
    strcpy ( names[i], name[i] );
    }

    does anyone know why this doesnt work?? I get an error of :
    cpp(66) : error C2664: 'strcpy' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'char *'

    please help me out
    thanks
    abbs
    The one & only!!

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    139
    and why don't you just do it this way
    Code:
    for (int i=0;i<divmax;i++)
      names[i]=name[i];
    "The most common form of insanity is a combination of disordered passions and disordered intellect with gradations and variations almost infinite."

  3. #3
    Registered User abbynormal87's Avatar
    Join Date
    Apr 2002
    Posts
    17

    thanks

    ok thanks...... lostmind
    The one & only!!

  4. #4
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    For single chars and chars in arrays you can use the = operator

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A Full Program to analyze.
    By sergioms in forum C Programming
    Replies: 2
    Last Post: 12-30-2008, 09:42 AM
  2. Strcpy
    By Godders_2k in forum C Programming
    Replies: 17
    Last Post: 12-12-2007, 12:34 PM
  3. Where is strcpy() defined? (Can't find in string.h ect)
    By Zero_Point in forum C++ Programming
    Replies: 6
    Last Post: 04-03-2006, 05:14 PM
  4. Question about strcpy
    By Kevinmun in forum C Programming
    Replies: 4
    Last Post: 11-02-2005, 11:00 PM
  5. strcpy
    By Luigi in forum C++ Programming
    Replies: 17
    Last Post: 02-16-2003, 04:11 PM