

Adding space to strcat
source link: https://www.codesd.com/item/adding-space-to-strcat.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Adding space to strcat
I have two strings char str1[41]
e char str2[41]
. If I use strcat
function to concatenate them I get an unique string without space instead I would have space between these.
this could be a way:
strcat(strcat(str1, " "),str2)
Does it exist another way?
sprintf(destination, "%s %s", str1, str2);
You'll have to provide a destination. You could use str1
as your destination and it might work correctly, but note the way you're currently doing things could cause you to overrun str1
s buffer.
asprintf()
will allocate a buffer for you, of the correct (read: safe) length, but you must remember to free()
that buffer when you're done with it.
Related Articles
Adding space between the bullet and the text in td
Display of the new input value (adding spaces)
Difficulty adding spaces around equal signs using regular expressions with Notepad ++
Adding space to complete the table length
python adding space after some clusters or characters
Perform equal size strings by adding spaces
Adding space to a specific position in a string of uppercase and lowercase letters
Adding space between fragments with a layout in Android
Adding space to the recycling reserve
Adding space to a string
Can I prevent returns in my code from adding spaces between form elements?
Online keyboard adding space
C ++ getline adding spaces
Adding space to select the option as alter
Recommend
-
113
Easily adding WireGuard to Android ROMs Easily adding WireGuard to Android ROMs Jason A. Donenfeld
-
91
Adding Support for Doctrine ORM•Updated: Mar 4, 2020•Published: Jan 4, 2018Hannes V.Doctrine is one of the most popular object-relational mapping libraries in the PHP community. It sh...
-
111
Page not found · GitHub Pages File not found The site configured at this address does not contain the requested file. If this is your...
-
153
除非特别声明,此文章内容采用知识共享署名 3.0许可,代码示例采用Apache 2.0许可。更多细节请查看我们的服务条款。
-
53
除非特别声明,此文章内容采用知识共享署名 3.0许可,代码示例采用Apache 2.0许可。更多细节请查看我们的服务条款。
-
108
A blog by the V8 team for JavaScript enthusiast that want to get a glimpse 'under the hood' of Chrome's JavaScript engine.
-
53
If you look at Apple’s “What’s New in iOS” 12 page , you’ll find a section entitled “Interactive Controls in Notifications,” which exclaims: Notificat...
-
58
If you are one of the happy readers ofmy article about TDD + Serverless architecture, just keep reading because to...
-
6
HorizontalScrollView in TabHost adding extra space at the end advertisements In order to easily switch between fragments, I'm em...
-
3
Can Disk Space Be Saved in MySQL by Adding a Primary Key?February 9, 2024 Przemysław MalkowskiHistorically, MySQL does not requir...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK