473,322 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

itoa

hi,
all i want is a simple function that takes an int, and returns a char*

so i tried

char * itoa(int i)
{
char buff[35];
return _itoa(i,buff,10);
}

but all it spits out is jibberish.
i don't understand why it's so necessary to have to pass in a c-string,
use a function to modify it, and then print it. it makes it highly
irritating when i want to do something like

printf("%s", itoa(my_int));

but noo...! instead i have to do

char my_string[32];
itoa(my_int,my_string,10);
printf("%s, my_string);

blah.

anyways... i'm sure there's a solution out there. does anyone know it?

Jan 1 '06 #1
24 8118
Mark wrote:
hi,
all i want is a simple function that takes an int, and returns a char*

so i tried

char * itoa(int i)
{
char buff[35];
return _itoa(i,buff,10);
}

but all it spits out is jibberish.
i don't understand why it's so necessary to have to pass in a c-string,
use a function to modify it, and then print it. it makes it highly
irritating when i want to do something like

printf("%s", itoa(my_int));

but noo...! instead i have to do

char my_string[32];
itoa(my_int,my_string,10);
printf("%s, my_string);

blah.

anyways... i'm sure there's a solution out there. does anyone know it?


How about the C++ faq:
http://www.parashift.com/c++-faq-lit...al-issues.html

Regards,
Peter Jansson
Jan 1 '06 #2
kind of an ugly round-about solution, but it works; thanks

const char * itoa(int i)
{
ostringstream o;
o << i;
return o.str().c_str();
}

dont think i should have to use std:strings so that i can return a
char* though.

Jan 1 '06 #3
kind of an ugly round-about solution, but it works; thanks

const char * itoa(int i)
{
ostringstream o;
o << i;
return o.str().c_str();
}

dont think i should have to use std:strings so that i can return a
char* though.

Jan 1 '06 #4
hm.. the problem i'm having is that when i do

printf("Kill %s %s for %s at '%s'.", act.units == 0 ? "all" :
itoa(act.units), getUnit(act.score), getGroup(act.group1),
itoa(act.location));

it prints "24" as the location, when it should be "64".
note that act.group1 is 24.

(yes there is a reason im using %s instead of %i or %d, but %i does fix
the problem...)

Jan 1 '06 #5
errr... nvm. it must be a problem with printf. if you do something like

printf("%s %s %s",itoa,itoa,itoa) it will always take the first one for
all 3.

Jan 1 '06 #6
i'd just like to point out how frusterated and disappointed i am with
c++ at the moment.
java would not give me a single problem with this. i had to rewrite

printf("Kill %s %s for %s at '%s'.", act.units == 0 ? "all" :
itoa(act.units), getUnit(act.score), getGroup(act.group1),
itoa(act.location));

to

cout << "Kill ";
if(act.units == 0) cout << "all";
else cout << (int)act.units;
cout << " " << getUnit(act.score) << " for " <<
getGroup(act.group1) << " at '" << act.location << "'.";

because apparently the ? operator cant mix and match return types, nor
can the << operator combine ints, or even chars with c-strings.

it's so ugly >.< just to do something so simple!!!

Jan 1 '06 #7
You shouldn't let your ignorance cloud your judgement. Java is a very
different language than C or C++. You obviously don't understand how
memory is used/allocated. If you're an amateur programmer and you
don't want to learn C++, then stick with Java. If you wish to learn
C++, then people (I anyway) will be happy to help you.

Jan 1 '06 #8
Mark napisał(a):
kind of an ugly round-about solution, but it works; thanks

const char * itoa(int i)
{
ostringstream o;
o << i;
return o.str().c_str();
}
you return a pointer into some buffer (associated with 'o') here, but
that buffer no longer exist after function returns

the simplest way to avoid the problem here is to return std::string from
the function - it carrys a buffer in itself

std::string itoa(int i) {
ostringstream o;
o << i;
return o.str();
}

dont think i should have to use std:strings so that i can return a
you should, unless you want to provide your own buffor, which you will
need to pass to the function, or (bad idea) create dynamically (with
new/malloc etc ...) inside the function (and destroy when appropriate
), but than you got more problems with buffor size ...
char* though.

Jan 2 '06 #9
Try:

char * itoa(int i)
{
static char buff[35];
return _itoa(i,buff,10);
}
--
---------------------------------------------------------------------
DataGet® & PocketLog® www.dataget.com
Data Collectors www.baxcode.com
--------------------------------------------------------------------

"Mark" <mn*******@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
hi,
all i want is a simple function that takes an int, and returns a char*

so i tried

char * itoa(int i)
{
char buff[35];
return _itoa(i,buff,10);
}

but all it spits out is jibberish.
i don't understand why it's so necessary to have to pass in a c-string,
use a function to modify it, and then print it. it makes it highly
irritating when i want to do something like

printf("%s", itoa(my_int));

but noo...! instead i have to do

char my_string[32];
itoa(my_int,my_string,10);
printf("%s, my_string);

blah.

anyways... i'm sure there's a solution out there. does anyone know it?

Jan 2 '06 #10
Mark wrote:
i'd just like to point out how frusterated and disappointed i am with
c++ at the moment.
java would not give me a single problem with this. i had to rewrite

printf("Kill %s %s for %s at '%s'.", act.units == 0 ? "all" :
itoa(act.units), getUnit(act.score), getGroup(act.group1),
itoa(act.location));

to

cout << "Kill ";
if(act.units == 0) cout << "all";
else cout << (int)act.units;
cout << " " << getUnit(act.score) << " for " <<
getGroup(act.group1) << " at '" << act.location << "'.";

because apparently the ? operator cant mix and match return types, nor
can the << operator combine ints, or even chars with c-strings.

it's so ugly >.< just to do something so simple!!!


Hi,

I have no comment about the beauty of the code but I guess your problem
was solved?

Regards,
Peter Jansson
Jan 2 '06 #11

"Mark" <mn*******@gmail.com> schrieb im Newsbeitrag
news:11**********************@o13g2000cwo.googlegr oups.com...
errr... nvm. it must be a problem with printf. if you do something
like

printf("%s %s %s",itoa,itoa,itoa) it will always take the first one
for
all 3.


Sure, because itoa has a static buffer for these operations. It
returns you the same address all the time.
If you want it this way, you have to return a std::string and use
their .c_str() member like this:
std::string xitoa(int i)
{
ostringstream o;
o << i;
return o.str()
}

printf("%s, %s", xitoa(15).c_str(), xitoa(25).c_str() );

Jan 2 '06 #12
Mark wrote:
i'd just like to point out how frusterated and disappointed i am with
c++ at the moment.
java would not give me a single problem with this.


There's no question that C++ can be frustrating, most especially to
beginners. Even more so to those who have been previously sold on the
easy get-up-and-go of a language like Java. But if you're serious
about programming with a truly powerful and expressive tool, stick with
it and don't be so easily discouraged. The fact is, C++ is such a
flexible language, pretty much all the "easy to use" idioms from Java
or wherever could be implemented as libraries.

But the base language, and the standard C and C++ libraries, have their
reasons for being the way they are. When you get done being
frustrated, take a moment and get educated about why things are the way
they are. You may find, as many of us have, that from the perspective
of a professional software engineer, some of these decisions are
incredibly shrewd and elegant, once you get into the appropriate
mindset to appreciate them.

Read a book or three. Koenig and Moo's "Accelerated C++" is widely
recommended. I'd also suggest you add Stroustrup's "The Design and
Evolution of C++;" it's not a language tutorial, but rather a sort of
history of how and why the language has developed the way it has.
Understanding the principles upon which it operates can help one get
into that mindset, and avoid much frustration. It's also a very
enjoyable read (I'm about halfway through it myself at the moment, just
got it a few days ago).

And if reading, gasp, *multiple* books seems like too much effort...
well, stick with Java. I use both languages professionally, and IMHO
there's really no comparison. Java's great for many things, but C++
tends to be a preferable choice for the really interesting problems.
It's harder to master, sure... but while calculus is harder to master
than arithmetic, if all you ever learn is arithmetic you're not going
to be much of a mathematician.

Luke

Jan 2 '06 #13

Mark wrote:
kind of an ugly round-about solution, but it works; thanks

const char * itoa(int i)
{
ostringstream o;
o << i;
return o.str().c_str();
}

The approach in the FAQ is

std::string itoa(int i)
{
std::ostringstream o;
o << i;
return o.str();
}

That's a huge difference. This returns a std::string by value, which is
a *copy* of the string in the ostringstream.

Your version returns a pointer to the char* data of the string in the
ostringstream. That pointer is valid only as long as the string exists
and is not modifed. After the function returns, the ostringstream and
the string in it, having automatic storage duration, are destroyed.

Because the pointer returned by the function points into nowhere,
dereferencing it has undefined behaviour. It seems that you were
unlucky and got exactly the behaviour you wanted. Undefined behaviour
means that anything can happen, including, unfortunately, just what you
expect.
dont think i should have to use std:strings so that i can return a
char* though.


I don't think you should have to use char* just to return a string.

char* is a seriously low level tool for representing and working with
strings. If you want to use the low level tool, you have to be prepared
to take manual responsibilty for the low level memory management
required.

If you don't want that responsibility, and for general use of strings
in C++ you almost never do, then use std::string. That's what it's for.

Gavin Deane

Jan 2 '06 #14
well, ok, i could use std::strings, but printf won't accept them, so i
have to convert them where ever i want to use them, right?

and i don't really like all these assumptions about me being new to
C++. yes, i understand where that's coming from, but i've used C++ for
a couple years, unfortunately without any proper instruction.

i've learnt the basics in school, and the rest i've taught myself.
needless to say, the teacher never really covered pointers and such.
i've mostly spent my time teaching myself game design, on a need to
know basis. when i run into a problem, i run out and find the
solution, and thus i'm constantly learning.

i just completed my first semester in university... in which i had to
learn Java. i wasn't keen on it at first, thinking C++ was
superior..but grudgingly i think i gave into some of Java's simplicity
of string handling.

i've always tried to advoid std:strings and other libraries i didn't
program myself... always thinking there is too much baggage, or they
aren't compatible with other functions and such.

anyways... that's my story.

http://groups.google.com/group/comp....4ab6951b54236d

so.. by making it static, the buffer data is sort of "locked" in
memory, and thus it doesnt get overwritten or lost when the function
returns. thus our pointer will still point to meaningful data,
correct?

running this quick test,

#include <cstdlib>
#include <iostream>

using namespace std;

char * itoa(int i)
{
static char buff[35];
return _itoa(i,buff,10);

}

int main(int argc, char *argv[])
{
printf("%s %s %s", itoa(1), itoa(2), itoa(3));
system("PAUSE");
return EXIT_SUCCESS;
}

it prints "1 1 1"

now if i'm not mistaken, since the buffer is in the same memory
location each time the function is called (because it's static)... all
3 pointers should point to the same location in memory, which is
probably why they are printing the same thing.

now what i'm thinking really happens, is that itoa is called 3 times,
the pointers are returned, and THEN the "%s %s %s" is evaluated, using
what happens to be the same pointer, rather than evaluating each %s and
corresponding parameter at the same time....

which all makes very good sense to me now. i feel clever for figuring
that out .. i hope i'm right :D

lol.

so i'm thinking
http://groups.google.com/group/comp....3e00fcce160384 would
be my best solution? (xitoa)

are there any other print functions that actually take std:strings as
parameters?
or is there a way i could do "my string" + 5 + my_other_string?

Jan 3 '06 #15
Mark wrote:
well, ok, i could use std::strings, but printf won't accept them, so i
have to convert them where ever i want to use them, right?

and i don't really like all these assumptions about me being new to
C++. yes, i understand where that's coming from, but i've used C++ for
a couple years, unfortunately without any proper instruction.

i've learnt the basics in school, and the rest i've taught myself.
needless to say, the teacher never really covered pointers and such.
i've mostly spent my time teaching myself game design, on a need to
know basis. when i run into a problem, i run out and find the
solution, and thus i'm constantly learning.

i just completed my first semester in university... in which i had to
learn Java. i wasn't keen on it at first, thinking C++ was
superior..but grudgingly i think i gave into some of Java's simplicity
of string handling.

i've always tried to advoid std:strings and other libraries i didn't
program myself... always thinking there is too much baggage, or they
aren't compatible with other functions and such.

anyways... that's my story.

http://groups.google.com/group/comp....4ab6951b54236d

so.. by making it static, the buffer data is sort of "locked" in
memory, and thus it doesnt get overwritten or lost when the function
returns. thus our pointer will still point to meaningful data,
correct?

running this quick test,

#include <cstdlib>
#include <iostream>

using namespace std;

char * itoa(int i)
{
static char buff[35];
return _itoa(i,buff,10);

}

int main(int argc, char *argv[])
{
printf("%s %s %s", itoa(1), itoa(2), itoa(3));
system("PAUSE");
return EXIT_SUCCESS;
}

it prints "1 1 1"

now if i'm not mistaken, since the buffer is in the same memory
location each time the function is called (because it's static)... all
3 pointers should point to the same location in memory, which is
probably why they are printing the same thing.

now what i'm thinking really happens, is that itoa is called 3 times,
the pointers are returned, and THEN the "%s %s %s" is evaluated, using
what happens to be the same pointer, rather than evaluating each %s and
corresponding parameter at the same time....

which all makes very good sense to me now. i feel clever for figuring
that out .. i hope i'm right :D

lol.

so i'm thinking
http://groups.google.com/group/comp....3e00fcce160384 would
be my best solution? (xitoa)

are there any other print functions that actually take std:strings as
parameters?
or is there a way i could do "my string" + 5 + my_other_string?


OK, I'm nitpicking, but please take this on a constructive note: Don't
type like you are conversing through an IM client. Use capitalization
and proper punctuation and the like, and you're bound to be taken more
seriously. Improper use of things like this indicate you are speaking
down to your reader --- as if he/she is not worth your effort to reach
over and hit the shift key now and then.

Thanks,
-JJ
Jan 3 '06 #16
It's my style. Books can be written in this nature, I don't understand
why a post can't.
I do appreciate your comments, but it is a bit like a conversation,
isn't it?
But perhaps I shall try to clean up my posts from this point forth. I
understand that you are not the only person with that opinion.

Jan 3 '06 #17
Mark wrote:
well, ok, i could use std::strings, but printf won't accept them, so i
have to convert them where ever i want to use them, right?
Who says you need to use printf? And you can extract a char* form
std::string using the c_str().

and i don't really like all these assumptions about me being new to
C++. yes, i understand where that's coming from, but i've used C++ for
a couple years, unfortunately without any proper instruction.
Your new then. If you weren't new you'd not be asking these questions.

i've always tried to advoid std:strings and other libraries i didn't
program myself... always thinking there is too much baggage, or they
aren't compatible with other functions and such.
Making tons of mistakes in your programming reinventing what the
implementation is required to provide is BAGGAGE.
so.. by making it static, the buffer data is sort of "locked" in
memory, and thus it doesnt get overwritten or lost when the function
returns. thus our pointer will still point to meaningful data,
correct?
You're not new and you don't know what "static" means?

Yes static storage means that it won't go away when the function
returns. There exists exactly one copy of that static variable
that is used for all invocations of the function. If you were
to print out the poitner, that itoa is returning you'll see it
is always the same value.


so i'm thinking
http://groups.google.com/group/comp....3e00fcce160384 would
be my best solution? (xitoa)
Exactly what we've been telling you. It uses std::string which unlike
char* IS A STRING TYPE.

You could do
printf("%s %s %s", xitoa(1).c_str(), xitoa(2).c_str(), xitoa(3).c_str());

If you really need to pass the result to printf.
are there any other print functions that actually take std:strings as
parameters?
or is there a way i could do "my string" + 5 + my_other_string?


Yes, look at what xitoa does internally:

ostringstream os;
os << "my string" << 5 << my_other_string;
return os.str();

An ostringstream builds up a string that contains the things you output
to it just as if you were outputing to say cout. The str() method
returns a copy of that internal string.
Jan 3 '06 #18

Ron Natalie wrote:
Mark wrote:
well, ok, i could use std::strings, but printf won't accept them, so i
have to convert them where ever i want to use them, right?


Who says you need to use printf? And you can extract a char* form
std::string using the c_str().

and i don't really like all these assumptions about me being new to
C++. yes, i understand where that's coming from, but i've used C++ for
a couple years, unfortunately without any proper instruction.


Your new then. If you weren't new you'd not be asking these questions.

i've always tried to advoid std:strings and other libraries i didn't
program myself... always thinking there is too much baggage, or they
aren't compatible with other functions and such.


Making tons of mistakes in your programming reinventing what the
implementation is required to provide is BAGGAGE.
so.. by making it static, the buffer data is sort of "locked" in
memory, and thus it doesnt get overwritten or lost when the function
returns. thus our pointer will still point to meaningful data,
correct?


You're not new and you don't know what "static" means?

Yes static storage means that it won't go away when the function
returns. There exists exactly one copy of that static variable
that is used for all invocations of the function. If you were
to print out the poitner, that itoa is returning you'll see it
is always the same value.


so i'm thinking
http://groups.google.com/group/comp....3e00fcce160384 would
be my best solution? (xitoa)


Exactly what we've been telling you. It uses std::string which unlike
char* IS A STRING TYPE.

You could do
printf("%s %s %s", xitoa(1).c_str(), xitoa(2).c_str(), xitoa(3).c_str());

If you really need to pass the result to printf.

are there any other print functions that actually take std:strings as
parameters?
or is there a way i could do "my string" + 5 + my_other_string?


Yes, look at what xitoa does internally:

ostringstream os;
os << "my string" << 5 << my_other_string;
return os.str();

An ostringstream builds up a string that contains the things you output
to it just as if you were outputing to say cout. The str() method
returns a copy of that internal string.


I meant other than ostringstream, but I guess that should work fine.
No more questions.

Jan 4 '06 #19

Mark wrote:
well, ok, i could use std::strings, but printf won't accept them, so i
have to convert them where ever i want to use them, right?
Not if you do you input and output using streams (like cin and cout) -
see below.

<snip>
i've always tried to advoid std:strings and other libraries i didn't
program myself... always thinking there is too much baggage, or they
aren't compatible with other functions and such.
The facilities of the C++ standard library (strings, streams,
containers, algorithms, etc.) are fully compatible with each other by
design and provide commonly needed functionality out of the box.

<snip>
running this quick test,

#include <cstdlib>
#include <iostream>

using namespace std;

char * itoa(int i)
{
static char buff[35];
return _itoa(i,buff,10);
}

int main(int argc, char *argv[])
{
printf("%s %s %s", itoa(1), itoa(2), itoa(3));
system("PAUSE");
return EXIT_SUCCESS;
}

it prints "1 1 1"

now if i'm not mistaken, since the buffer is in the same memory
location each time the function is called (because it's static)... all
3 pointers should point to the same location in memory, which is
probably why they are printing the same thing.

now what i'm thinking really happens, is that itoa is called 3 times,
the pointers are returned, and THEN the "%s %s %s" is evaluated, using
what happens to be the same pointer, rather than evaluating each %s and
corresponding parameter at the same time....

which all makes very good sense to me now. i feel clever for figuring
that out .. i hope i'm right :D
Yes you are right. All the arguments to a function are fully evaluated
_before_ the function itself is called. Parsing "%s %s %s" and
inserting the character sequences obtained by dereferencing the pointer
arguments happens _inside_ the printf function, so by the time it
happens, the three itoa calls are complete.

So what actually gets printed is whatever was stored in the buffer by
the last of the three calls to itoa. In your case, the last call must
have been itoa(1). That's allowed - the compiler does not have to
evaluate the function arguments in the order they apppear in your code.
It can evaluate them in any order it likes.
are there any other print functions that actually take std:strings as
parameters?
or is there a way i could do "my string" + 5 + my_other_string?


#include <string>
#include <iostream>

int main()
{
std::string my_other_string = "my other string";
std::cout << "my string" << 5 << my_other_string << "\n";

return 0;
}

Gavin Deane

Jan 4 '06 #20

Gavin Deane wrote:
Mark wrote:
well, ok, i could use std::strings, but printf won't accept them, so i
have to convert them where ever i want to use them, right?


Not if you do you input and output using streams (like cin and cout) -
see below.

<snip>
i've always tried to advoid std:strings and other libraries i didn't
program myself... always thinking there is too much baggage, or they
aren't compatible with other functions and such.


The facilities of the C++ standard library (strings, streams,
containers, algorithms, etc.) are fully compatible with each other by
design and provide commonly needed functionality out of the box.

<snip>
running this quick test,

#include <cstdlib>
#include <iostream>

using namespace std;

char * itoa(int i)
{
static char buff[35];
return _itoa(i,buff,10);
}

int main(int argc, char *argv[])
{
printf("%s %s %s", itoa(1), itoa(2), itoa(3));
system("PAUSE");
return EXIT_SUCCESS;
}

it prints "1 1 1"

now if i'm not mistaken, since the buffer is in the same memory
location each time the function is called (because it's static)... all
3 pointers should point to the same location in memory, which is
probably why they are printing the same thing.

now what i'm thinking really happens, is that itoa is called 3 times,
the pointers are returned, and THEN the "%s %s %s" is evaluated, using
what happens to be the same pointer, rather than evaluating each %s and
corresponding parameter at the same time....

which all makes very good sense to me now. i feel clever for figuring
that out .. i hope i'm right :D


Yes you are right. All the arguments to a function are fully evaluated
_before_ the function itself is called. Parsing "%s %s %s" and
inserting the character sequences obtained by dereferencing the pointer
arguments happens _inside_ the printf function, so by the time it
happens, the three itoa calls are complete.

So what actually gets printed is whatever was stored in the buffer by
the last of the three calls to itoa. In your case, the last call must
have been itoa(1). That's allowed - the compiler does not have to
evaluate the function arguments in the order they apppear in your code.
It can evaluate them in any order it likes.
are there any other print functions that actually take std:strings as
parameters?
or is there a way i could do "my string" + 5 + my_other_string?


#include <string>
#include <iostream>

int main()
{
std::string my_other_string = "my other string";
std::cout << "my string" << 5 << my_other_string << "\n";

return 0;
}

Gavin Deane


Thanks Gavin :)

Nice to know some people are a little more polite.

Jan 4 '06 #21
Baxter wrote:
Try:

char * itoa(int i)
{
static char buff[35];
return _itoa(i,buff,10);
}


We routinely ask this question as part of the interview process at my
company, and this approach is well below par. Firstly, '_itoa' is not
standard. However, if you are referring to '_itoa' as defined on MSDN
(http://msdn.microsoft.com/library/de..._._ui64tow.asp)
the second comment is that the function is not built for testability.
For example,

Return Value
Each of these functions [_itoa] returns a pointer to string.
There is no error return.

How can you prove the correctness of a function that does not indicate
error conditions? Lastly, the function is not thread-safe.

A good starting point is

int itoa(char *buffer, std::size_t length, int value);
// Store into the specified 'buffer' of the specified 'length'
// the ASCII representation of the specified 'value'.
// Return 0 on success, and a non-zero value otherwise.
// In particular, return a non-zero value if 'length' is not
// large enough to represent 'value'.

This contract allows for a wide variety of black-box and white-box
testing. Now, how would you implement this?

Jan 4 '06 #22
Mark wrote:
running this quick test,

#include <cstdlib>
#include <iostream>

using namespace std;

char * itoa(int i)
{
static char buff[35];
return _itoa(i,buff,10);
static char b, buff[3][35];
sprintf(buff[b%=3], "%i", i);
return buff[b++];

}

int main(int argc, char *argv[])
{
printf("%s %s %s", itoa(1), itoa(2), itoa(3));
system("PAUSE");
return EXIT_SUCCESS;
}

it prints "1 1 1"

Jan 5 '06 #23
???

Jan 7 '06 #24
Diego Martins wrote:
???


Well, there's an informative post.

Brian
Jan 7 '06 #25

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: John Lenton | last post by:
Is there any reason python's printf-style formatting is missing the (C99) '%a' specifier? I'm sorry if this has been asked and answered before; I can't find it on google ('%a' is a very awkward...
7
by: news.hku.hk | last post by:
Excuse me, i write the following function to add comma for integers but the unix server said: In function `class string comma(int)': implicit declaration of function `int itoa(...)'...
4
by: Moritz Beller | last post by:
Hello! Is there an equivalent to Visual C++'s itoa function in gcc? best regards Moritz Beller -- web http://www.4momo.de mail momo dot beller at t-online dot de...
1
by: tigui1984 | last post by:
j'aimerais avoir les sources c++ de la fonction itoa... jai qque problemes avec cette fonction sur linux.
2
by: Raskolnikow | last post by:
Hi! I have a very simple problem with itoa() or the localtime(...). Sorry, if it is too simple, I don't have a proper example. Please have a look at the comments. struct tm *systime; time_t...
2
by: Sona | last post by:
Hi, I have a char* that holds an ascii character in its first element (at least I think that's what it holds because when I print it, it prints weird characters). I need to convert this into an...
29
by: pete | last post by:
I wrote a version of itoa yesterday. Features: 1 No implementation defined arithmetic. All of the division and modulus division is done on positive values only. 2 No object is assumed...
11
by: rayw | last post by:
I'm pretty new to C, although I did do some years ago now. I've been told that itoa is no longer a standard function, and that the ato... functions - although in the std - are not recommended. ...
7
by: silverburgh.meryl | last post by:
Hi, Can you please tell me where I can find itoa()? I try to compile the following example, but I get the following error: .../t.cpp:20:2: warning: no newline at end of file .../t.cpp: In...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.