Solved

sprintf in VB

Posted on 1998-06-18
6
559 Views
Last Modified: 2012-08-13
what would the replacement  for format data command in C such as spirntf.
eg) sprintf((tmpstr, "%02%02", x,y)
code will help.
Thank you
0
Comment
Question by:platiumstar
  • 2
  • 2
  • 2
6 Comments
 

Expert Comment

by:RentRight
ID: 1463720
Format$(x, "00") & Format$(y, "00")
0
 

Author Comment

by:platiumstar
ID: 1463721
your answer is close, but I think there is a slight difference between these, the number of bytes allocated is different.
unless I'm totally confused about how these commands work.

thanks
0
 
LVL 1

Expert Comment

by:brunchey
ID: 1463722
what does sprintf do in C?  does this just print a line of text
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 1

Expert Comment

by:brunchey
ID: 1463723
what does sprintf do in C?  does this just print a line of text
0
 

Accepted Solution

by:
RentRight earned 50 total points
ID: 1463724
sprintf will yield 5 bytes because strings in C are null terminated. I did not know you wanted the null terminator.  If you do change it to
Format$(x, "00") & Format$(y, "00") & chr(0)
0
 

Author Comment

by:platiumstar
ID: 1463725
thanks for the answer.
for brunchey:

sprintf() format stuff into a string, you can pack anything, numbers, characters, ...
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now