Luca
I’m writing a concurrency program that manage multiple files. I would like to keep every read/write operation atomic on the same file, so just a single thread at a time is allowed to read/write on a certain file. What can I do?
Luca
I noticed that flock() funlock() are related just with Linux, I need something that work on every OS
Anonymous
can anyone help me with this please😢
Roshan
Read rules
Anonymous
this is not c++????
Anonymous
me a noob
Roshan
this is not c++????
Use http://paste.ubuntu.com
Anonymous
Use http://paste.ubuntu.com
this is for what¿
Roshan
this is for what¿
Paste code in it... And send the link here.
Anonymous
can u do that for me
Anonymous
i cant understand how to do that
Igor🇺🇦
I noticed that flock() funlock() are related just with Linux, I need something that work on every OS
If you can use boost you can use https://www.boost.org/doc/libs/1_74_0/doc/html/boost/interprocess/file_lock.html
Anonymous
If you can use boost you can use https://www.boost.org/doc/libs/1_74_0/doc/html/boost/interprocess/file_lock.html
/* PSOE Ites not ineger, bytes, but we will read as integer. 1144306736 standing 1143847984 crouched 1143684144 creep */ Entities[i]->playerPose = iGet(Entities[i]->playerWorld + 0x130); Entities[i]->playerHealth.max = fGet(Entities[i]->entityAddv + 0x77C); Entities[i]->playerHealth.cur = fGet(Entities[i]->entityAddv + 0x778); Entities[i]->playerEnergy.max = fGet(Entities[i]->entityAddv + 0x1408); Entities[i]->playerEnergy.cur = fGet(Entities[i]->entityAddv + 0x140C); DWORD weaponsCapsule = dGet(Entities[i]->entityAddv + 0x12C); Entities[i]->playerIsAttacking = false; for(int w = 0; w < 4; w++){ DWORD weaponBase = dGet(weaponsCapsule + w * 4); DWORD weaponAmmoBase = dGet(weaponBase + 0x54); Entities[i]->playerWeapons[w].activity = iGet(weaponBase + 0xDC); Entities[i]->playerWeapons[w].state = iGet(weaponBase + 0x4C0); Entities[i]->playerWeapons[w].entityId = iGet(dGet(weaponBase + 0x4BC) + 0xC0); Entities[i]->playerWeapons[w].maxAmmo = iGet(weaponAmmoBase + 0x7D4); Entities[i]->playerWeapons[w].curAmmo = iGet(weaponAmmoBase + 0x7D0); } // Bones Entities[i]->boneActor = vectorBoneRead(Entities[i]->bodyAddv); for(int b = 0; b < 15; b++){ Entities[i]->playerBones[b] = getPlayerBone(Entities[i]->boneAddv, Entities[i]->boneActor, i, b); }
Anonymous
paste this brother @Roshan_Pradhan1098
Dima
lol
Anonymous
i self.reported 😂😂Lol
Anonymous
Bruh
@
Title: Write structure programming in C language that should be able to do the following: 1. Shuffling the deck of playing card. 2. Distributing the card among four players, one card to each player then second card to each and so on. 3. The player having maximum similar cards ( like all 13 hearts) consider as winner. Write all the assumptions, the report must include: i. Introduction to the work. ii. Each task should be defined under separate function. [1] [2] iii. Comments to understand the codes should be [2] iv. Function main() should contain all variable need with [2] included. proper name. v. Screen shot of all experimental outputs. [3]
Dima
Wtf
Xudoyberdi
Wtf
+😂
Apk
Wow😂
Puspam
What a reason! 😂
Roshan
😶
Anunay
😂
mov $22, %rax
guys, do you know something about avr architecture?
Anonymous
ya
Anonymous
Hello. I Wana cast a lparam to some structure in my code.(on windows) And after that, access members of that struct and do some calculations. Sometimes this cast results to null. And if I access those members of struct, I'll get a segfault. How ensure about validity of these kinds of casts and prevent segfault? Edit : I know I should ensure about casting, but it's necessary for my app. Because 90% of logic of my app happens after this cast.
Anonymous
Print lparam out to see if it is null before casting
PaAaAria
https://hastebin.com/goputulafa.cpp hey guys in this code, if-condition doesn't work. could anybody help me to solve this problem?
Anonymous
http://format.krzaq.cc/
PaAaAria
http://format.krzaq.cc/
thx🙏, I used it, I hope the code is formatted now https://hastebin.com/jahiyoloma.cpp
stelina
Hello everyone So i have this homework to do, but i really don't understand what is the point of this assignment. So if anyone is Free to give me a hand on understaning it, i'd really appriciate it(i am not asking for the code to copy and paste it, i really need to understand the problem!!!) .Since is a really long pdf It would be more comfortable to write in private in order to not make a mess here. Thank you! ^^
꧁༒•Sir Aleko•༒꧂
Heloo
Anonymous
Someone who would edit or tell me how to beautify the code?
Muhammad Saad
Guys can you please tell me how can I find and display the smallest and largest word in character array?
Anonymous
Yes, but why do you reinterpret_cast (That's UB)?
because i know that Plugin_Base * mixer is an instance of Plugin_Types_Mixer
Roshan
string four; four[0] = '0'; four[1] = '0'; four[2] = '1'; cout<<four; This prints nothing. What am I doing wrong here??
olli
because i know that Plugin_Base * mixer is an instance of Plugin_Types_Mixer
I thought so, but you should use a static_cast (or dynamic_cast) instead
olli
consider this, what output do you expect? #include <cstdio> struct B1 { virtual void bar() { std::puts("B1::bar"); } }; struct B2 { virtual void foo() { std::puts("B1::foo"); } }; struct D : B1, B2 {}; int main() { D d; B2* b = reinterpret_cast<B2*>(&d); b->foo(); return 0; }
Roshan
You assumed that C++ strings is the same as C char pointer / array.
I had to create an array of binary numbers, for which I was using strings to store the bits. If not in this way... Then how to store it in one string??
Anonymous
I had to create an array of binary numbers, for which I was using strings to store the bits. If not in this way... Then how to store it in one string??
You can create array of numbers, but you can’t assign numbers in binary representation. What you mean by storing in one string ?
Roshan
You can create array of numbers, but you can’t assign numbers in binary representation. What you mean by storing in one string ?
I was just trying everything possible, and got this working... string four = "hey"; four[0] = '0'; four[1]= '0'; four[2] = '1'; cout<<four; How?
Roshan
You can create array of numbers, but you can’t assign numbers in binary representation. What you mean by storing in one string ?
You there?? I think I'm editing the string. So will I need a temporary string of known size?
Ralph
So if you're now using cout << four[0] the output would be 0 and not h
Ralph
"" is for a string and '' is for a character
Ralph
Am i wrong??
olli
"" is for a string and '' is for a character
yes, so four[0] = "0" does not work (/Wpedantic)
Roshan
You there?? I think I'm editing the string. So will I need a temporary string of known size?
So how will I convert binary to decimal. I thought of using a for loop and perform sum += pow(2, i); (if bin[i] is '1') Now it's inaccessible...
Ralph
I mixed python with cpp 😅
Ralph
What is the problem? @Roshan_Pradhan1098 can you please repeat?
olli
The question
what's the "bigger picture"? if you're numbers are not exceeding 1E18 use uint_fast64_t otherwise you could use std::bitset
Roshan
cin>>n; for(i = 0; n >= 1; i++){ stringstream ss; ss << n % 2; ss >> bin[i]; n/=2; } cout<<"Binary: : "; for(i-=1; i >= 0; i--){ cout<<arr[i]; }
olli
How to delete the unused memory here in bin[100];
you can't change the size of an array, you could create a new one with the appropriate size. you could however use a vector. But I'm still not sure what exactly you're trying to do and why you need an array of each "bit"
MᏫᎻᎯᎷᎷᎬᎠ
How to delete the unused memory here in bin[100];
You can't delete an array in the stack neither part of it If you want some resizing mechanisms, use std::vector
MONSTER
test
YUSUF
Learning SFML IS worth full or not
YUSUF
Linklist
YUSUF
Learning sfml is use full
YUSUF
Or not
Roshan
Learning SFML IS worth full or not
I was just wondering to make some games in SFML in this Lockdown. 😂 So I started learning it...
YUSUF
And I also want machine learning in c++ and I want free cours plz help