Solved

sprintf in VB

Posted on 1998-06-18
6
543 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
Comment Utility
Format$(x, "00") & Format$(y, "00")
0
 

Author Comment

by:platiumstar
Comment Utility
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
Comment Utility
what does sprintf do in C?  does this just print a line of text
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 1

Expert Comment

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

Accepted Solution

by:
RentRight earned 50 total points
Comment Utility
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
Comment Utility
thanks for the answer.
for brunchey:

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

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 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

14 Experts available now in Live!

Get 1:1 Help Now