|
Converts some ASCII number into long. First, this function skips white spaces (including the spaces at the ends of lines), then tries to detect the base by checking the beginning of the number. It understands these hexadecimal prefixes: 'x<hex-val> 0x<hex-val> H'<hex-val> h'<hex-val> -<dec-val> <dec-val>' where hex-val is some set of hexadecimal digits (0123456789ABCDEFabcdef), val - decimal value. -
Parameters:
-
sz_source
|
a string to be converted. |
-
Returns:
-
long value produced by interpreting the input characters as a number.
#include <cywin.h>
...
long device_id;
struct cDialog dialog;
struct module_t main_module;
char sz_device_id[11];
...
init_module( &main_module );
...
cDialog_ctor( &dialog,
"Connection property",
"Enter device id:",
mbOk | mbCancel | mbEdit,
10,
main_module.m_process );
if( cDialog_ShowModal( &dialog ) == mrOk )
{
cDialog_GetEditText( &dialog, sz_device_id );
}
cDialog_dtor( &dialog, LEAVE_MEMORY );
device_id = xtoi( sz_device_id );
... |