\Device\NUL
Jillur Rahman
I am a C beginner.I have solved 200+ problems so far of data types,conditional statements,loop and some array and string as well.Now I want to shift to C++.How can I do it now in the most possible productive way?
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
hi, in a client server application with TCP sockets, should I use read/write or recv/send?
Both my server and my client use signal handling with sigaction, for istance CTRL+C shuts down the server istantly;
The client also uses fgets to take input.
What I want is that, no metter if in read from/write on socket operation (both Client and Server) or if in a fgets operation (client), when
a signal arrives, the signal must be handled.
I hear that recv/send can be made non blocking, is this enough to solve my problem?
رغد🖤
Hello, can any of you tell me how he became good with C Plus, what was his step that he took? I do a lot, but unfortunately I make a lot of mistakes
رغد🖤
C++
㋡𝕄ℝ➸ 𝕊𝕀𝕄𝕆™
رغد🖤
Ziky
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
yes it is, it's been set with sigaction in the main of the software, therefore it should always be ready to kick in when needed, it's just that sometimes it doesn't
Vitor
Hello guys, im new to C and i want to know how to read an enviroment variable from a .env file
Spam
Hi guys I’m looking for a c++ brush up walkthrough or anything of that sort
Ziky
Actually what does it mean to brush up / learn C++ ?
- fundamental classes and inheritance?
- learn features c++17?
- learn even modules and other woodoo from c++ 20
- learn c++ in focus for embedded devices (no or custom dynamic allocation, constant expressions, things like newlib or custom stdlib, taming linker to put pieces on desired places in memory...)
- Functional safety - like MISRA, wriitng unit testable code and measure test coverage...
- Focus on libraries like Qt, STL boost...
itsmanjeet
What is the problem?
solved now, i am trying to learn about template specialization but never make them work, getting compilation error saying ::type is not a something of something i forget 😅, I somehow make it work using concept create a new concept from the specialized template and use requires keyword to enable that concept,
but i don't the people post code on google are without concept ??
Lee
stop = false; // stop is given the value of 0
while (!stop) { // !stop = 1
m = (r + s) / 2.0;
double y_m;
y_m = a3 * pow(m, 3) + a2 * pow(m, 2) + a1 * m + a0;
if (y_m == 0 || abs(s - r) < 0.000001) {
t = m;
cout << " The solution is " << fixed << setprecision(6) << t << ".\n";
stop = true; // stop is true indicates that stop = 1,
}
Lee
Danya🔥
Danya🔥
Do not write to the PM without permission
Danya🔥
When the condition is false — loop stops
When you set stop = true, the condition becomes false
What do you not understand exactly?
Danya🔥
Yes
Lee
then the while loop stop looping at the end where stop = true
Lee
why it stop since it meet the condition in the while loop
Danya🔥
Danya🔥
When you set stop = true, the condition !stop becomes false
Danya🔥
When the condition is false — loop stops
Danya🔥
Do you see the connection?
Danya🔥
Maybe you need to read some books before coding?
Chat Boss
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Hi guys, I have a basic signal handling question.
Both my Client and my Server only handle two signals: SIGINT and SIGPIPE using sigaction in the main process of the software. Is it right for the main process to ignore everything else?
Furthermore, my server occasionally spawns threads to handle clients.
Those threads don't handle signals, thought they look for their copy of errno (in the thread local storage) and if it's == EPIPE or == EINTR they do stuff.
Therefore, should I specifically set the threads to ignore ALL signals?
Subhomoy Saha
Hello
klimi
Ziky
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
hi guys, if I write on socket like this:
while(write(socket, MEX, strlen(MEX) == -1){
// check for EPIPE error;
}
let's assume this is MEX:
const char *MEX= "--a24h5Hf8Hk";
Sometimes the client will recieve the right thing. Other times, the client will recieve
-a24h5Hf8Hk
So the first "-" is missing. Can you tell me why this happens?
Exec
Hi, im still learning how to use cmake, when i run make, i got error
/usr/bin/ld : cannot find -lglm : no such file ...
How to fix this?
I've done the google way but still the same error
Artur
Isn’t glm header only library ?
Artur
I think glm is headed only library therefore there isn’t anything to link against to
Suka
Chat Boss
Ricardo Milos ® sent a code, it has been re-uploaded as a file
Ricardo
anyone has any idea about Exception has occurred.
Segmentation fault ?
Ricardo
"Exception has occurred.
Segmentation fault"
klimi
Ricardo
Ricardo
i just simply point to element i of array A[ ], and what i got is segmentation fault
klimi
Anonymous
Anyone who knows how to translate integer or float to binner with function?
𝔖𝔞𝔯𝔬
klimi
Ricardo
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
hi guys, so I have my client that writes on socket with a read call. If SIGPIPE kicks in, the client is ready to handle it with its own handler. The problem is that read is blocking, therefore it won't do anything until the call to write is not over. For istance, I take input with fgets, and while fgets occurs, SIGPIPE kicks in. The fgets call is blocking, therefore the client does not stop.
The user tries to enter some input, presses CTRL+C and then there's the write to server. So to sum up:
fgets();
»» »»» DURING FGETS THE CLIENT IS HIT BY SIGPIPE
write();
the problem is that the client, after being hit by SIGPIPE, does not handle the signal with its handler, it just goes in an undefined behaviour where the write writes to the server, the server does not answer because it's off and the client is stuck. Do you know why my Client won't go in the sigpipe handler after fgets?
Jillur Rahman
How to convert decimal to binary in c?
Carlo
how can I implement cin from scratch using only unistd.h?
Ziky
hi guys, so I have my client that writes on socket with a read call. If SIGPIPE kicks in, the client is ready to handle it with its own handler. The problem is that read is blocking, therefore it won't do anything until the call to write is not over. For istance, I take input with fgets, and while fgets occurs, SIGPIPE kicks in. The fgets call is blocking, therefore the client does not stop.
The user tries to enter some input, presses CTRL+C and then there's the write to server. So to sum up:
fgets();
»» »»» DURING FGETS THE CLIENT IS HIT BY SIGPIPE
write();
the problem is that the client, after being hit by SIGPIPE, does not handle the signal with its handler, it just goes in an undefined behaviour where the write writes to the server, the server does not answer because it's off and the client is stuck. Do you know why my Client won't go in the sigpipe handler after fgets?
So the handler is not even called?
𝔖𝔞𝔯𝔬
𝔖𝔞𝔯𝔬
You mean like to print it ?
𝔖𝔞𝔯𝔬
Exactly how do you want bits to be rappresented
Davit
Hello
Help me if you can
I have the code
And I want the relay to turn off after executing this code
void onRelay3Change() {
Serial.println("On-Change Event Relay3");
if (relay3 == 1) {
digitalWrite(relay1_pin, HIGH);
digitalWrite(relay4_pin, HIGH);
}
else {
digitalWrite(relay1_pin, LOW);
delay(2000);
digitalWrite(relay4_pin, LOW);
}
Holup
Hello there good people!
How do I typecast a char array element to an int element? For example:
char a[10];
a[5] = '2';
int b = (int)a[5] + 0;
printf("%d", b);
I wish to convert the a[5] element into an integer data type. But the code above doesn't seem to achieve that. (It doesn't print 2. But prints the ASCII value of 2. Which is 50)
Saint Paul
An
Holup
Why + 0?
It's just an example code.
Holup
Holup
Holup
But typecast still not possible?
Saint Paul
no
Holup
atoi() can't do that with char type :[
Says: no matching function to call for atoi()
Edit: Figured it out. I need to pass the address to the atoi() function
An
char a = '2';
int b = a - '0';