Re: convert int to string without using standard library (stdio.h)



Thanks for the repy:

I need to convert number (int, short) to a string but cannot use
sprintf as I am using an embedded system. I want to mix text and
number in a display function on the system's output (It doesn't support
printf) but it does have a text to screen function that accepts
strings. I would like to display counters with a message along with it.


Hope my question is clear now.

Thanks in advance,
cQ


spibou@xxxxxxxxx wrote:
ceeques wrote:

Hi

I am a novice in C. Could you guys help me solve this problem -

I need to convert integer(and /short) to string without using sprintf
(I dont have standard libray stdio.h).

for instance:-
int i =2;
char ch 'A

My result should be a string ==> "A2"

I don't understand what you're trying to do. Please
provide more examples. Also write down what your
function should accept as arguments and what its
return type should be. And also try to avoid syntax
errors like char ch 'A' ; it makes it harder to see what
your aim is.

Results are not going to a standard output - I have a function to
readout/display string from memory.

Ok , so where results should go then ?

.



Relevant Pages

  • Re: socket communication: send & receive doesnt work right
    ... So I don't want to send a string as bytes. ... public void send_doubles(double vals, int len) throws ... // send a short acknowledgement to the server ... char *result; ...
    (microsoft.public.win32.programmer.networks)
  • Re: [PATCH] markers: modpost
    ... pointers to the name/format string pairs. ... The same can then be done with modules using the __markers section. ... +static void read_markers(const char *fname) ... int main ...
    (Linux-Kernel)
  • Re: [PATCH] markers: modpost
    ... This adds some new magic in the MODPOST phase for CONFIG_MARKERS. ... will be a neighbor of its format string. ... +static void read_markers(const char *fname) ... int main ...
    (Linux-Kernel)
  • Re: Is this code totaly a shit?
    ... | void UppStrg(char *Low, char *Upp, int cnt); ... whitespace-delimited string. ... You're also assuming that the representations of the characters ...
    (comp.lang.c)
  • Re: A string collection abstract data type
    ... duplicate string in Insert, InsertAt, ReplaceAt; ... used int instead of size_t for count and size for consistency with API. ... char *(StringCollection *SC, int idx, ... static int IsReadOnly; ...
    (comp.lang.c)