BinaryByter
maybe
Anonymous
and we are talking about C here
Anonymous
std::strcat also exists
Joe
and we are talking about C here
sorry i think i didn`t clarify, my program is C++
Joe
ok
Joe
so something like string += [x-value] += " " += "/n" would work in C++?
Anonymous
no
Mihail
After that use +
Anonymous
string = string + std::string([x-value]) + "/n";
Anonymous
this is likely what you mean
Anonymous
i do not get what you meant by x-value
Anonymous
string = string + std::string([x-value]) + "/n";
if that is a character then this is valid
Anonymous
if it is a number then it is not valid
Joe
string = string + std::string([x-value]) + "/n";
OK i understand. the std::string converts an int/double /whatever to string?
Joe
its int actually
Roxifλsz 🇱🇹
OK i understand. the std::string converts an int/double /whatever to string?
The std::string() is a string constructor it can take various things, such as, in your case an int
Joe
thanks guys
Anonymous
that is not true
Anonymous
if you want an int then you should use: std::to_string
Anonymous
however this thing is only from C++11
Joe
if you want an int then you should use: std::to_string
ok is it that this function is faster?
Anonymous
for what?
BinaryByter
converting ints to strings in general is slow
BinaryByter
unless you copy the int verbatim
Anonymous
really depends on what you want
Anonymous
to_string will change based on the parameter you send it
Anonymous
if you send it an int
Anonymous
it will use atoi
Anonymous
i suggest not converting
Anonymous
itoa?
BinaryByter
itoa does the reverse
BinaryByter
in general, for conversion I advise the use of stringstreams
BinaryByter
they are good wrappers around the c-style conversion functions
Joe
I'll try both options and see what's faster
Aimal
How to search for a specific word in a string of sentence?
BinaryByter
How to search for a specific word in a string of sentence?
you go through each element of the string and then look at the characters in front of it
BinaryByter
so you have two loops
Anonymous
in general, for conversion I advise the use of stringstreams
that is basically what std::to_string does
BinaryByter
Yes
Anonymous
but it is slightly more optimized
BinaryByter
he doesn't
Anonymous
it would be much simpler to have the binary encoding inside the string
Anonymous
then just standardize it
BinaryByter
strings are for human readable IMHO
Anonymous
so all machines use either little or big endian
BinaryByter
use std::vector<char> or std::string_view<char> for non-human-readable
Anonymous
and then we send that around
BinaryByter
too lazy
BinaryByter
+ i already gave you enough information
BinaryByter
*I'm the bad guy ¯\_(ツ)_/¯*
Anonymous
how about the find() member function
Anonymous
or .substring
BinaryByter
BinaryByter
that makes everything so much easier
BinaryByter
xD
Anonymous
which is what i said
Anonymous
it also has a .substr member
BinaryByter
time for me to read the standard
Anonymous
no
>when the C master racer knows more about C++ strings then the C++ master racer
Anonymous
xD
Aimal
Thanks 😊
Aimal
in C++ you can just do .find
Great, will check this
Alessio
Hi all, does anyone know where I can find and download an example of code in visual studio c++ using database for example sqlite. Thank you so much!
Anonymous
does the atoi() convert string to int or the reverse?
Anonymous
visual studio is too complex
Anonymous
ok thx
Alessio
visual studio is too complex
I understood too late.