This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

String strang strung

He guys,
just took a look at my little codefragment

        text[5]=' ';
        text[6]='k';
        text[7]='g';


How to put this in one single line?
for example

//This does'nt works!
         text[5 to 7]=" kg";


Sorry for this stupid question, i guess there is a solution, but i was interrested in another idea than mine :-)

Parents
  • "What is better, this or strcpy? Where are differences?"

    What are your requirements regarding the NUL-terminator?

    strcpy() copies its second argument including the argument string's NUL-terminator.

    If that's not what you want, then use strncpy() with the third argument chosen to avoid copying the NUL-terminator or assign characters to individual string (array) elements.

Reply
  • "What is better, this or strcpy? Where are differences?"

    What are your requirements regarding the NUL-terminator?

    strcpy() copies its second argument including the argument string's NUL-terminator.

    If that's not what you want, then use strncpy() with the third argument chosen to avoid copying the NUL-terminator or assign characters to individual string (array) elements.

Children
No data