flat assembler
Message board for the users of flat assembler.
Index
> Windows > how to convert int/string float/string and vice versa |
Author |
|
vid 12 Jan 2008, 11:59
wtf?
first you ask something, and then you say not to tell you the answer? |
|||
12 Jan 2008, 11:59 |
|
0.1 12 Jan 2008, 12:01
simply because those function are defined by C standard!
i wanted to know if there are windows api specifics? |
|||
12 Jan 2008, 12:01 |
|
vid 12 Jan 2008, 12:37
yes, microsoft did lot of custom libc-like functions
|
|||
12 Jan 2008, 12:37 |
|
bitRAKE 12 Jan 2008, 12:59
What is it you are trying to avoid? Including runtime DLL, or the C-like interface? The API has functions like wsprintf which will do the conversion and user32 is very likely to be mapped into address space. kernel32 has string functions as well.
|
|||
12 Jan 2008, 12:59 |
|
0.1 12 Jan 2008, 13:13
well ... for example the scanf is defined by C standard so it should be there but can not use full platform support!
what I was looking (at least hoping) for was any particular conversion function in the API itself (different from C functions). I was wondering if I could find more powerful (having more control maybe) functions in the API. Take a simple example: I use: scanf("%d", &num); but user enters: abcd now scanf() can't manage that very well! so may be an API function is there which would plain reject (and may be beep as well) all the other data except one which it was supposed to read! I made and earlier post seeking for an API specific function to read from kbd. I was hoping to find a function that would allow some more editing features besides just the back space! |
|||
12 Jan 2008, 13:13 |
|
vid 12 Jan 2008, 13:20
Quote: now scanf() can't manage that very well! What it can't manage so well about it? You just have to learn how to use it. There is one thing that scanf doesn't manage well for some reason though - overflows. |
|||
12 Jan 2008, 13:20 |
|
0.1 12 Jan 2008, 13:22
i expected an integer!
user enters a string! go figure! what scanf can't handle! |
|||
12 Jan 2008, 13:22 |
|
vid 12 Jan 2008, 13:29
again.. what doesn't scanf() handle about it? what should it do differently?
|
|||
12 Jan 2008, 13:29 |
|
0.1 12 Jan 2008, 13:35
OMG!
why don't you understand? scanf will return me wrong data! but if some function existed that would not allow me type anything besides digits ... and it's possible if i use API features I guess! may god help me! |
|||
12 Jan 2008, 13:35 |
|
bitRAKE 12 Jan 2008, 13:39
0.1, yeah - that is a problem. Best use an edit control that is limited to numbers, or you'll have to loop for user to re-enter or cancel.
|
|||
12 Jan 2008, 13:39 |
|
vid 12 Jan 2008, 13:42
Quote: scanf will return me wrong data! scanf returns perfectly valid result, it's just that you can't use it properly. Before trying to use some function, study how to use it: http://msdn2.microsoft.com/en-us/library/9y6s16x1(VS.71).aspx Quote: but if some function existed that would not allow me type anything besides digits ... You don't understand how streams work. "scanf" doesn't have any control over the code which handles console input. There may be no console at all, and STDIN can be redirected from file. |
|||
12 Jan 2008, 13:42 |
|
0.1 12 Jan 2008, 13:46
whatever the doo-hee-kee you said vid!
i know scanf has no control coz stdin can be blah blah blah that's exactly why i am looking for a replacement from api! i would post my code (that would not allow invalid data (on console!)) in an hour or so ... but i don't have pc at home and i can't do this at work! |
|||
12 Jan 2008, 13:46 |
|
vid 12 Jan 2008, 13:59
Quote: that's exactly why i am looking for a replacement from api! There is no such function... it would be pretty stupid idea, and it will fail in case there is no console. You can write such function yourself, but it won't be so trivial, and there is no point in doing it. Instead, check if user entered valid number, and if not, display error |
|||
12 Jan 2008, 13:59 |
|
Madis731 12 Jan 2008, 20:31
Maybe he wanted atoi() itoa() ^o) Aren't they Uindooze
|
|||
12 Jan 2008, 20:31 |
|
AlexP 14 Jan 2008, 01:14
Okay, I've seen a getch() good-looking loop that would, upon entering a number/character, immediately print a * in the position. It works so fast under C that you couldn't tell, so that would work for you?? Just use getch() in a pretty loop?? I use it all the time for pauses in my prgms, either that or submit to using the vas array of C RUNTIME LIBRARIES THAT COME WITH WINDOWS IN THE FIRST PLACE!!! Don't be die hard because those functions in the C library are part of Windows API, u are the one not getting it.
|
|||
14 Jan 2008, 01:14 |
|
0.1 14 Jan 2008, 06:28
_________________ Code: o__=- ) (\ /\ |
|||
14 Jan 2008, 06:28 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.