Jump to content

The V C++ GUI Framework:V Utilities: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
mNo edit summary
 
Line 2: Line 2:


==Synopsis==
==Synopsis==
; '''Header:'''
;Header: <tt><v/vutil.h></tt>
: <tt>[vquickr.htm#VUTIL <v/vutil.h>]</tt>


==Description==
==Description==
'''''V''''' provides several utility functions that can often help with software portability (and can just be useful). These are free subprograms - not a member of any specific class.
'''''V''''' provides several utility functions that can often help with software portability (and can just be useful). These are free subprograms - not a member of any specific class.


====void ByteToStr(unsigned char b, char* str)====
;void ByteToStr(unsigned char b, char* str):This will convert the unsigned char in <tt>b</tt> to a ''Hex'' character string in <tt>str</tt>. You need to make <tt>str</tt> big enough to hold the string.
 
;void IntToStr(int intg, char* str):This will convert the integer in <tt>intg</tt> to a character string in <tt>str</tt>. You need to make <tt>str</tt> big enough to hold the string.
This will convert the unsigned char in <tt>b</tt> to a ''Hex'' character string in <tt>str</tt>. You need to make <tt>str</tt> big enough to hold the string.
;void LongToStr(long intg, char* str):This will convert the long integer in <tt>intg</tt> to a character string in <tt>str</tt>. You need to make <tt>str</tt> big enough to hold the string.
 
;long StrToLong(char* str):This will convert the character string in <tt>str</tt> into a long integer. You can cast to get ints.
====void IntToStr(int intg, char* str)====
;void vBeep():This utility routine will sound an audible beep.
 
;void vGetcmdIdIndex(ItemVal cmdId, CommandObject *cmdObj):Sometimes when you work with a CommandObject array to define a dialog, you need to access the elements of a particular item in the array. This is especially true for manipulating lists. This routine will return the index into a CommandObject array of an entry with the supplied <tt>ItemVal cmdId</tt>.
This will convert the integer in <tt>intg</tt> to a character string in <tt>str</tt>. You need to make <tt>str</tt> big enough to hold the string.
;void vGetLocalTime(char* tm):This will return a string representation of the current local time to the string <tt>tm</tt>. The format will be ''HH:MM:SS AM''. If you need a different format, you will need to use the C functions <tt>time</tt>, <tt>localtime</tt>, and <tt>strftime</tt> directly.
 
;void vGetLocalDate(char* dt):This will return a string representation of the current local date to the string <tt>dt</tt>. The format will be ''MM/DD/YY''. If you need a different format, you will need to use the C functions <tt>time</tt>, <tt>localtime</tt>, and <tt>strftime</tt> directly.
====void LongToStr(long intg, char* str)====
 
This will convert the long integer in <tt>intg</tt> to a character string in <tt>str</tt>. You need to make <tt>str</tt> big enough to hold the string.
 
====long StrToLong(char* str)====
 
This will convert the character string in <tt>str</tt> into a long integer. You can cast to get ints.
 
====void vBeep()====
 
This utility routine will sound an audible beep.
 
====void vGetcmdIdIndex(ItemVal cmdId, CommandObject *cmdObj)====
 
Sometimes when you work with a CommandObject array to define a dialog, you need to access the elements of a particular item in the array. This is especially true for manipulating lists. This routine will return the index into a CommandObject array of an entry with the supplied <tt>ItemVal cmdId</tt>.
 
====void vGetLocalTime(char* tm)====
 
This will return a string representation of the current local time to the string <tt>tm</tt><nowiki>. The format will be ``HH:MM:SS AM''. If you need a different format, you will need to use the C functions </nowiki><tt>time</tt>, <tt>localtime</tt>, and <tt>strftime</tt> directly.
 
====void vGetLocalDate(char* dt)====
 
This will return a string representation of the current local date to the string <tt>dt</tt><nowiki>. The format will be ``MM/DD/YY''. If you need a different format, you will need to use the C functions </nowiki><tt>time</tt>, <tt>localtime</tt>, and <tt>strftime</tt> directly.


[[Category:V C++ GUI Framework]]
[[Category:V C++ GUI Framework]]

Latest revision as of 02:04, 10 April 2020

Several useful utility functions.

Synopsis

Header
<v/vutil.h>

Description

V provides several utility functions that can often help with software portability (and can just be useful). These are free subprograms - not a member of any specific class.

void ByteToStr(unsigned char b, char* str)
This will convert the unsigned char in b to a Hex character string in str. You need to make str big enough to hold the string.
void IntToStr(int intg, char* str)
This will convert the integer in intg to a character string in str. You need to make str big enough to hold the string.
void LongToStr(long intg, char* str)
This will convert the long integer in intg to a character string in str. You need to make str big enough to hold the string.
long StrToLong(char* str)
This will convert the character string in str into a long integer. You can cast to get ints.
void vBeep()
This utility routine will sound an audible beep.
void vGetcmdIdIndex(ItemVal cmdId, CommandObject *cmdObj)
Sometimes when you work with a CommandObject array to define a dialog, you need to access the elements of a particular item in the array. This is especially true for manipulating lists. This routine will return the index into a CommandObject array of an entry with the supplied ItemVal cmdId.
void vGetLocalTime(char* tm)
This will return a string representation of the current local time to the string tm. The format will be HH:MM:SS AM. If you need a different format, you will need to use the C functions time, localtime, and strftime directly.
void vGetLocalDate(char* dt)
This will return a string representation of the current local date to the string dt. The format will be MM/DD/YY. If you need a different format, you will need to use the C functions time, localtime, and strftime directly.