fancy strcpy

This is a discussion on fancy strcpy within the C++ Programming forums, part of the General Programming Boards category; listen you fruity piece of ****. you dont tell me what to do on this board. I have seniority over ...

  1. #16
    Registered User
    Join Date
    Dec 2001
    Posts
    206
    listen you fruity piece of ****. you dont tell me what to do on this board. I have seniority over you(not that it matters), and i damn well dont see you doing any help on this board. i go as far as writing whole working programs and u sit here telling me im an idiot? well go cry to someone else cause i dont care about your personal problems homo.

  2. #17
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    quote:
    >>--------------------------------------------------------------------------------

    >>*craps pants*

    >>--------------------------------------------------------------------------------



    >young children tend to do that

    hehe

  3. #18
    SeŮor Member
    Join Date
    Jan 2002
    Posts
    561
    Denethor, you're wrong. Stop complaining and insulting the correct people because you're not getting anywhere. Back to the original question.
    Code:
    char a1='r';
    char a2='f';
    char mystring[2];
    mystring[0]=a1;
    mystring[1]=a2;
    Whoever asked the original question, when you combine characters, you get a string which is an array of characters. If you don't know what an array is look at the tutorials on this site.

  4. #19
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459

    [moderator warning]

    Let's please get along fyodor and denethor, shall we? If not, then there will be moderation and consequences. There is no need for foul language, nor excessive use of capital letters. And most of all it would be appreciated if we did not have to point out that we were right, rather let the example speak for itself.

    Heat551, can you be more specific with your question? Thank you.

    -doubleanti
    hasafraggin shizigishin oppashigger...

  5. #20
    Registered User
    Join Date
    Apr 2002
    Posts
    200
    I don't recall using foul language, but I apologize if I offended anyone. It's just that I read and post on seven or eight forums a day and CAPS get annoying.

  6. #21
    Registered User Liam Battle's Avatar
    Join Date
    Jan 2002
    Posts
    114
    well im gonna add to this post cuz it was funny.. and i believe the original poster wanted to combine two chars from seperate strings or single char data type and put them into one string...

    cuz he does not sounds advanced enough to want to ASCII numbers added to each other...

    if you wanted to add the VALUE ( NOTE VALUE) of a char, remember a CHAR is essentially an Integer, its a 1 byte, 8 bit, 255 combination of 1's and 0's...



    have fun
    LB0: * Life once school is done
    LB1: N <- WakeUp;
    LB2: N <- C++_Code;
    LB3: N >= Tired : N <- Sleep;
    LB4: JMP*-3;

  7. #22
    Peace
    Join Date
    Aug 2001
    Posts
    1,510
    ss3x and swoopy both provided legitimate answers to the question.

    You are intentionally being confusing Denthor2000, and there is also the point about the CAPS spamming. Please restrain yourself.
    "There's always another way"
    -lightatdawn (lightatdawn.cprogramming.com)

  8. #23
    Registered User JTtheCPPgod's Avatar
    Join Date
    Dec 2001
    Posts
    44
    Originally posted by swoopy
    I kind of interpreted what he said, to what he really meant. I could be wrong.
    Yea, you were actually the only one that understood his question... lol...
    "No! I must have my delicious cupcakes, my sweet cakey treasures, piping hot from their 40 watt WOMB!!!"
    --Captain Murphy

  9. #24
    Registered User heat511's Avatar
    Join Date
    Dec 2001
    Posts
    169

    ok, ill rephrase myself...

    sorry about that being so vague i was in a hurry

    i meant a char variable that is holding a string
    sorry, books don't explain terminology too well

    like this
    Code:
    char thisismychar[20]
    strcpy(thisismychar, "I'm holding a string");
    char anotherchar[20]
    strcpy(anotherchar, ", and so am I!");
    how would i combine the two strings or chars or whatever they are called into another char or whatever its called?

    thanks

  10. #25
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Uaaah and i posted first with the correct answer but i get no credit =P

  11. #26
    Registered User heat511's Avatar
    Join Date
    Dec 2001
    Posts
    169

    thank you swoppy!

    yay, someone did answer my question and not just spam

  12. #27
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Aha! Repent!
    A char is only able to hold one letter. Thats when arrays come in.
    When you do char blabla[50] you actually create 50 chars, one for each letter, which then become kind of "grouped" into the same name so that you can make them hold strings.
    So the correct term would be character arrays or strings.

    And use strcat() to combine stuff.
    It takes two char arrays and puts the last into the end of the first.
    For example:

    Code:
    char first[20], second[20], total[41];
    strcpy(total, first);
    strcat(total, second); // adds second to the end of total

  13. #28
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    )(#"/§)(/%)=§#)(& and when i finally answer he finds someone else that has. Grrrrrr :P:P:P

  14. #29
    Registered User heat511's Avatar
    Join Date
    Dec 2001
    Posts
    169

    i understand now!

    ok, thanks eriond i was calling character arrays "chars" my mistake

    by the way, i liked fightgame (until i got caught playing it during programming )
    "uh uh uh, you didn't say the magic word"
    -Jurassic Park

  15. #30
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Hehe thanks man!

Page 2 of 3 FirstFirst 123 LastLast
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, 06: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

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