Page 2 of 2

Re: I don't know how to use std::string?

Posted: Wed Nov 26, 2008 8:45 pm
by unholysavagery
avansc wrote:jesus, what happened do atoi, itoa, atof ... etc... see this is why you young people need to learn some C manners.
"warning C4996: 'itoa': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _itoa. See online help for details."

This function is deprecated, I already tried that and it worked but the correct way to do it is to use a std::string.

avansc your getting to old! :lol:

Re: I don't know how to use std::string?

Posted: Wed Nov 26, 2008 9:08 pm
by avansc
unholysavagery wrote:
avansc wrote:jesus, what happened do atoi, itoa, atof ... etc... see this is why you young people need to learn some C manners.
"warning C4996: 'itoa': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _itoa. See online help for details."

This function is deprecated, I already tried that and it worked but the correct way to do it is to use a std::string.

avansc your getting to old! :lol:
lolz, thats just a compiler warning, nothing serious. i doubt that you will trite code that will crash if you use it.
again, you compiled with a C++ compiler, try using something good like gcc.

i might be getting long in the tooth.. ;(

Re: I don't know how to use std::string?

Posted: Thu Nov 27, 2008 12:32 am
by Falco Girgis
avansc wrote:jesus, what happened do atoi, itoa, atof ... etc... see this is why you young people need to learn some C manners.
Yeah, that's what I was thinking when I saw this topic. That's why I didn't respond until after the solution had already been presented, because I don't know how the hell to do some of the good ol' fashioned C things with C++ whore strings.

Re: I don't know how to use std::string?

Posted: Thu Nov 27, 2008 12:33 am
by Falco Girgis
avansc wrote:
unholysavagery wrote:
avansc wrote:jesus, what happened do atoi, itoa, atof ... etc... see this is why you young people need to learn some C manners.
"warning C4996: 'itoa': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _itoa. See online help for details."

This function is deprecated, I already tried that and it worked but the correct way to do it is to use a std::string.

avansc your getting to old! :lol:
lolz, thats just a compiler warning, nothing serious. i doubt that you will trite code that will crash if you use it.
again, you compiled with a C++ compiler, try using something good like gcc.

i might be getting long in the tooth.. ;(
Yeah, Microsoft has new versions for all of the oldschool C functions that handle exceptions and stuff like that. I still recommend the standard C stuff...

Re: I don't know how to use std::string?

Posted: Thu Nov 27, 2008 1:34 am
by trufun202
In college, we weren't allowed to use strings - even if we wrote our own string class... It was char arrays all the way - but, it was good experience.

Re: I don't know how to use std::string?

Posted: Thu Nov 27, 2008 3:04 am
by unholysavagery
trufun202 wrote:In college, we weren't allowed to use strings - even if we wrote our own string class... It was char arrays all the way - but, it was good experience.
How long ago was this?

Re: I don't know how to use std::string?

Posted: Thu Nov 27, 2008 3:23 am
by unholysavagery
GyroVorbis wrote:
avansc wrote:
unholysavagery wrote:
avansc wrote:jesus, what happened do atoi, itoa, atof ... etc... see this is why you young people need to learn some C manners.
"warning C4996: 'itoa': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _itoa. See online help for details."

This function is deprecated, I already tried that and it worked but the correct way to do it is to use a std::string.

avansc your getting to old! :lol:
lolz, thats just a compiler warning, nothing serious. i doubt that you will trite code that will crash if you use it.
again, you compiled with a C++ compiler, try using something good like gcc.

i might be getting long in the tooth.. ;(
Yeah, Microsoft has new versions for all of the oldschool C functions that handle exceptions and stuff like that. I still recommend the standard C stuff...
Well I'm a perfectionist, I spent 2 months rewriting my code so I could remove a 64Kb memory leak. ;)

Re: I don't know how to use std::string?

Posted: Thu Nov 27, 2008 12:20 pm
by Arce
My shit leaked ~2 gb sys ram on Peter's comp at one point...Fucker, burn! :twisted:

Re: I don't know how to use std::string?

Posted: Thu Nov 27, 2008 11:31 pm
by MarauderIIC
GyroVorbis wrote:
avansc wrote:jesus, what happened do atoi, itoa, atof ... etc... see this is why you young people need to learn some C manners.
Yeah, that's what I was thinking when I saw this topic. That's why I didn't respond until after the solution had already been presented, because I don't know how the hell to do some of the good ol' fashioned C things with C++ whore strings.
In this case, I'd use itoa(). Although iirc it's not standard [but atoi is]. C++ doesn't really have better conversions...

Making your own itoa is this:

Code: Select all

char[] itoa(int i) {
    char buffer[256]; // w/e
    sprintf("%i", buffer);
    return buffer;
}

Re: I don't know how to use std::string?

Posted: Fri Nov 28, 2008 12:21 am
by trufun202
unholysavagery wrote:
trufun202 wrote:In college, we weren't allowed to use strings - even if we wrote our own string class... It was char arrays all the way - but, it was good experience.
How long ago was this?
2000? :(

Re: I don't know how to use std::string?

Posted: Fri Nov 28, 2008 12:33 am
by Falco Girgis
Yeah, I have had classes where we weren't allowed to use strings either. Honestly though, I think the character array manipulation was good for me. Too many C++ programmers don't know how to handle C style character arrays...

Re: I don't know how to use std::string?

Posted: Fri Nov 28, 2008 8:46 am
by unholysavagery
GyroVorbis wrote:Yeah, I have had classes where we weren't allowed to use strings either. Honestly though, I think the character array manipulation was good for me. Too many C++ programmers don't know how to handle C style character arrays...
I know how to do that and then some for instance I used to manage my own arrays and didn't even know about std::vector. You have no idea how complex that made stuff, I learned a lot from it though and I agree that itoa() is much more logical but I've been trying to do absolutely everything by the book. it's worked out well though most of the stuff I just find retarded, I'm hoping to use this as an example of my work in the future.

Re: I don't know how to use std::string?

Posted: Fri Nov 28, 2008 11:21 am
by avansc
unholysavagery wrote:
GyroVorbis wrote:Yeah, I have had classes where we weren't allowed to use strings either. Honestly though, I think the character array manipulation was good for me. Too many C++ programmers don't know how to handle C style character arrays...
I know how to do that and then some for instance I used to manage my own arrays and didn't even know about std::vector. You have no idea how complex that made stuff, I learned a lot from it though and I agree that itoa() is much more logical but I've been trying to do absolutely everything by the book. it's worked out well though most of the stuff I just find retarded, I'm hoping to use this as an example of my work in the future.
i would suggest not to use std::vector, especially if you are so adamant on staying efficient.
or anything C++ gives you that makes something people think is complicated into something thats easy.
if you dont know the machanics of something C++ is lettign you use you will have a shit hoard time trying to make something effiecient, becauyse you wont know where your code is being inefficient.

Re: I don't know how to use std::string?

Posted: Fri Nov 28, 2008 12:08 pm
by Falco Girgis
The standard template library in C++ is actually pretty damn huge when it comes to executable file size. I'm not saying whether I recommend you go one way or another, but you mentioned efficiency, so I thought that I would bring this up.