Solved

sprintf in VB

Posted on 1998-06-18
6
566 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

809 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