strcat

Started by
13 comments, last by Zahlman 16 years, 6 months ago
Thank you Janta that's exactly what i was trying to get at, i just never thought of using strcat twice.

Cheers mate.
Advertisement
Quote:Original post by Ronnie TRFC
Thank you Janta that's exactly what i was trying to get at, i just never thought of using strcat twice.

Cheers mate.


That was just the code that rip-off suggested a couples posts before...You haven't read carefully enough [smile]
Quote:Original post by janta
Quote:Original post by Ronnie TRFC
Thank you Janta that's exactly what i was trying to get at, i just never thought of using strcat twice.

Cheers mate.


That was just the code that rip-off suggested a couples posts before...You haven't read carefully enough [smile]
It was also suggested in the first sentence of the first reply to the thread :)
Quote:Original post by jyk
strcat() doesn't know anything about what 'should' go between the first and second strings; if you want a space there, you'll have to insert it manually (e.g. by making an additional call to strcat() with " " as the second argument).


Right about the second strcat but I meant my "code" was just exactly the same as what rip-off suggested when he said:

Quote:It would be better to strcpy firstname into fullname, then strcat " " onto fullname and finally to strcat Surname onto fullname


Allright, we're being nitpicky here [smile]

Cheers

Quote:Original post by Ronnie TRFC
Hi, I'm having a problem with the strcat function. I'm new to programming and just doing some simple exercises. Here's my problem, i ask the user to enter their first name, and surname, these are then stored in too seperate arrays. These arrays are then concatenated(sp?) using the strcat function and then copied into a final string which is then output to the screen. The only problem being that their is no space between the first and second name. Is it possible to ensure that a space goes in there?


1) For Beginners.


2) What language do you think that code is in? Seriously. Throw that book away. Burn it, ideally. It's an abomination.

This topic is closed to new replies.

Advertisement