strcpy

This is a discussion on strcpy within the C++ Programming forums, part of the General Programming Boards category; no, like this: Code: int main() { char str1[] = "APPLE PIE BUKKAKE PIZZA!!!", str2[27]; // Enough to hold our ...

  1. #16
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    no, like this:

    Code:
    int main()
    {
       char str1[] = "APPLE PIE BUKKAKE PIZZA!!!",
            str2[27]; // Enough to hold our string
    
       copy(str2, str1);
       cout << str2 << endl;
       return 0;
    }
    Or

    Code:
    int main()
    {
       char str1[] = "APPLE PIE BUKKAKE PIZZA!!!",
            str2* = new char[strlen(str1)+1]; // Enough to hold our string
    
       copy(str2, str1);
       cout << str2 << endl;
       delete [] str2;
       return 0;
    }
    Last edited by Polymorphic OOP; 02-14-2003 at 07:31 PM.

  2. #17
    Registered User
    Join Date
    Feb 2003
    Posts
    33
    Originally posted by Luigi
    To polymorphic :

    I dont knoow any chinese... but I do know what juju means for me..
    I took it from a game I used to play.
    In it I was a necromancer and I was controling a Zombie named Juju..
    its that simple..

    Also, I tried the code you offered and I still got a sigbus error code number 10 blah blah.. (same as previously stated..)

    Im begining to think that the problem comes from my compiler..

    (btw: project builder 2.1 for os X)

    Thx for the help.
    Luigi
    its not probably the compiler but you need to check the code.
    Snoop

  3. #18
    Burning in Hell! Luigi's Avatar
    Join Date
    Nov 2002
    Posts
    117
    why strcpy works with an array of char (char juju[];) and not with a cstyle string (char* juju;)??

    just wondering..

    Luigi

Page 2 of 2 FirstFirst 12
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, 08:42 AM
  2. Strcpy
    By Godders_2k in forum C Programming
    Replies: 17
    Last Post: 12-12-2007, 11:34 AM
  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, 10:00 PM
  5. strcpy command
    By Peachy in forum C Programming
    Replies: 10
    Last Post: 09-22-2001, 09:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21