Solved

sprintf in VB

Posted on 1998-06-18
6
553 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Put text in a picture ASP.NET C# 2 47
How to compare ms sql hashbytes results within vb6 5 51
VB6 - Convert HH:MM into Decimal 8 50
Add and format columns in vb6 7 42
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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 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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

947 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

23 Experts available now in Live!

Get 1:1 Help Now