Ioioio
Dima
local or external one?
Ioioio
Local
Anmol
That is not the problem I'm facing.
When i try to access TreeNode in the .cpp file, it gives me an error saying that it is an unidentified identifier
Jesvi
one simple question, which is better ?
Jesvi
python or c++, what are your thoughts ?
Dima
с++
Dima
python devs are weak and should treated as such
Dima
Ioioio
How to find ip address in c
Jesvi
Dima
How to find ip address in c
the first link in google, dayum
https://stackoverflow.com/questions/122208/get-the-ip-address-of-local-computer
MᏫᎻᎯᎷᎷᎬᎠ
😂😂😂😂😂😂😂😂
Dima
OwO
MᏫᎻᎯᎷᎷᎬᎠ
I won the argument
MᏫᎻᎯᎷᎷᎬᎠ
Damn it dima
It's easy to trigger you
Dima
show off however you want in ot group, please
Anonymous
Dima
Dima
external one or a local address
Anonymous
how to find external one ?
Dima
he said the local one
Nils
Can I somehow tell C/C++ to store a variable exactly after another one?
Nils
No nevermind. I got a much better idea
Nils
I simply concenated them manually
Nils
With an array
Nils
And casts
Mar!o
Mar!o
short 16-bits float 32 😬
Dima
float2 lol
Nils
void concated[sizeof(int) + (sizeof(float) * 2)];
concated[0] = (void)int1;
concated[sizeof(int)] = (void)float1;
concated[sizeof(int) + sizeof(float)] = (void)float2;
Something like that I think
Mar!o
Why not just union?
Nils
Nils
oh, right
Nils
I know
Mar!o
Yes and the union will have the size of the biggest element. So with a union with a short and float it will be size of float (32).
Why do you need them concatted?
Nils
All I want is being able to write the data inside a struct or something like that all together into some file
Nils
So I can just read back the contents into the struct later
Nils
But that struct contains char arrays
Nils
Which means that they have to be stored next to the struct
Mar!o
Ahhh you want to serialize types into byte arrays
Nils
Yes
Nils
Exactly
Nils
And nope, I don't want libraries 😉
Mar!o
Well a pointer cast is undefined AFAIK because of alignment... you can do that with unions too!
Mar!o
union int2bytes {
int i;
char c[sizeof(int)];
};
Mar!o
Then add the chars to your struct or serialize the whole union...
Mar!o
Better use fixed types like int32_t
Mar!o
Because int's size is variable....
Mar!o
But it's not wrong that the union will have the size of the largest element
Sinan
Why is the output of this code 8 ?
printf("%d", sizeof(NULL));
Anonymous
Anonymous
Nils
But wouldn't it simply write the adresses then?
Mar!o
Sinan
Oh okay thank you
Anonymous
it copies the chunk of memory to a file without losing any precision/performing human readable conversions
Nils
Anonymous
Anonymous
one string per iteration
Nils
Wait if I store a function inside the struct, will it get stored inside the file too???
Anonymous
it can write anything
okay maybe writing pointers doesn't make sense for fwrite() and fread()
Nils
That would be a huge security risk in some applications
Nils
Nils
Okay...
Basically I just a have a struct of data (including **char that I want to dump/restore to/from a file)
Nils
Nils
Nils
I thought that could help storing the **char contents
Nils
Yeah, I noticed that idea is bad
Nils
so I dropped it
Nils
Oh
Nils
Damn I am stupid
Anonymous
Oh
which would be pretty much impossible unless you are using an embedded system where you can control everything