Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

sprintf formating data?

Status
Not open for further replies.

drzsmith

Newbie level 3
Joined
Mar 18, 2012
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
hi when using sprintf for a value which is less than the width specifier the extra spaces are paded with spaced (0x20)

for exsample

PHP:
code
num = 1234
length = sprintf(buf,%8d,num)
code

length = 8 (1234 space space space space), can null be used rather than a space?

thanks
 

You would have to rewrite/modify the routine.

However, I believe the string library routines contained in string.h would be more applicable to your requirements as they typically terminate the string with a NULL.

Checkout, strcpy() and strcat():

cstring (string.h)


BigDog
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top