Anonymous
everyone seems to be bot here. Sorry if you're a "human".
Anonymous
Okie. Thanks! :))
Souking
Hello guys, Please does anyone counter strange behavior with HMAC-SHA512 after applying it the second time the result is different from the expected ..
Ausir
Hi guys, I'm studying C programming oriented to processes etc... Now I'm trying to figure out how fork() works, I didn't understand a few things: 1- child process starts his execution from the line which the fork is called or it will start from the beginning? 2- How can I determinate how many processes will be generated in a for loop? There's a formula? Some of you guys can help me?
Wisenky
{ Map::getLaby()->generateLab(); Car car1 = Car(Map::getLaby(), "car1", 'K'); // creating a car object Car car2 = Car(Map::getLaby(), "car2", 'V'); car1._push(Map::getLaby()); car2._push(Map::getLaby()); } I want _push() functions run same time not one runs after the other one, How can I do sirs ?
Wisenky
You mean you want to do one function call instead of two _push?
I want to race the cars each other but now car1 finishes the race first then car2 starts to go
Pavel
I want to race the cars each other but now car1 finishes the race first then car2 starts to go
Ah ok, try to read about multithreading (it's a huge topic, but it is the way to run code in parallel). Otherwise you need to rethink your design.
Ausir
Child process copies most of the state of its parent. Meaning that it continues from the same point. That's why what is usually done is exec in a child process. https://en.wikipedia.org/wiki/Fork%E2%80%93exec
That's not what I asked for 😅 I need to figure out how this code works: int main() { 9 › int i; 10 › unsigned int my_pid, my_ppid, value; 11 › 12 › /* How many processes are really generated? */ 13 › for (i=0; i<NUM_FORKS; i++) { 14 › › 15 › › value = fork(); 16 › › my_pid = getpid(); 17 › › my_ppid = getppid(); 18 › › /* How many printed lines? */ 19 › › printf("PID=%6d, PPID=%6d, i=%d, fork_value=%d\n", 20 › › my_pid, my_ppid, i, value); 21 › › /*sleep(1); */ 22 › } 23 › exit(EXIT_SUCCESS); 24 }
Ausir
How can I understand how many processes a for loop can generate?
Pavel
How can I understand how many processes a for loop can generate?
First time see this fork(), but can think of, that can be because every new process was continuing the loop creating new processes?
Ausir
First time see this fork(), but can think of, that can be because every new process was continuing the loop creating new processes?
I don't know 😂 I can't understand what's going on 😂 the child process continue the execution from the line where fork is invoked or from the beginning? 🤷🏼‍♂
Ausir
Internet is not my friend in that case 😞
Ausir
From the same line https://www.geeksforgeeks.org/fork-system-call/
Thanks a lot I'll study it before say anything else ✌🏼 soon 💪🏼
Ausir
On first entry 1 process Second entry 2 processes 3rd entry 4 processes
That's not what happen on my terminal dude the printings are 30, for example the first iteration i=0 will be printed 2 times 🤷🏼‍♂
Igor🇺🇦
That's not what happen on my terminal dude the printings are 30, for example the first iteration i=0 will be printed 2 times 🤷🏼‍♂
Yes, that's what should happen. After "fork" you have 2 processes and they still have the value for i
Igor🇺🇦
Ok, bash is the parent than it creates 2 processes with i=0 but why 2?
Bash is not part of this. It's doesn't run this code
Ausir
./a.out is a child process of bash right?
Igor🇺🇦
It's is but that's non of you concern. It's OSs job
Igor🇺🇦
It's is but that's non of you concern. It's OSs job
Your "main" doesn't run in bash
Ausir
Ok let me see the link pavel sent to me, maybe I can figure out how that syscall works. I'll tell you what I'll understand and we can compare 🤞🏼✌🏼
Wisenky
oneAPI/TBB🤪
whats that
Aakash
whats that
Mr. Google is your beloved friend🤪
Igor🇺🇦
whats that
https://en.wikipedia.org/wiki/Threading_Building_Blocks
Igor🇺🇦
whats that
That's way over engineering for this purpose. std::thread is sufficient
Wisenky
That's way over engineering for this purpose. std::thread is sufficient
I solve my problem with thread but its seems really multi thread
Wisenky
I solve my problem with thread but its seems really multi thread
my cars finishes their race till program start then I cant seek the process :(
Igor🇺🇦
I solve my problem with thread but its seems really multi thread
? What's the point of using std::thread with a single thread? 🤷‍♂️
Wisenky
I'll change my design thanks
Anonymous
guys stupid question here.. .Does row == height or width? Im a bit confused parsing a 2d array!
Anonymous
thx m8!
Jaime
Feliz año y que Dios nos bendiga
Антон
Half of warning? 🤔
Pavel
Half of warning? 🤔
One from two possible :) Half of ban :)
Muhammad Saad
Anyone knows SFML?
Muhammad Saad
Anyone knows how to draw a circle inside a rectangle jn SFML?
Furkan
How can I improve myself on embedded software engineering, anyone can suggest website or tutorial?
ברני
How can I improve myself on embedded software engineering, anyone can suggest website or tutorial?
Write C practice on Google, go to the first site, if you did all the quests with no help, you're good
Furkan
Write C practice on Google, go to the first site, if you did all the quests with no help, you're good
Thank you for you reply, but I am not sure about just C is enough, I have background on desktop app with c++ but I want to learn concepts for embedded software side with c language
Anonymous
I don't have that much knowledge to be giving suggestions. But I think you may go for reading books
Anonymous
And practicing on our own. Because you already know C++ pretty well I suppose.
Anonymous
Does someone like to take a look at my source code in c?
tartaerae
hello, how to this array i entered to this loop? i have to try, but not shown what are include on this array. char vokal[6]={'a','i','u','e','o','\0'}; for (char vokal='a'; vokal<='o'; vokal++){ printf("%c\n", vokal); } so how i should write it?
Anonymous
/get cppbookguide
Anonymous
/get cbook
Anonymous
@everyone I need help. I have a project to make Cinema Movie Ticket App. Kindly help me to make it. I have no time to waste. Plz help me. I was sick and I wasn't able to take classes. So I can't understand the logic of this project. If anyone will help me I'll pray for him/her. And I'll be easy and watch the lectures I have been missed. Kindly help me.
Anonymous
did you mean pay instead of pray?
Not man, it is pray not pay.
Anonymous
do your own homework
Anonymous
Why reported?
Anonymous
Why reported?
breaks rule 3
Anonymous
do your own homework
I am not well. I have pain in Right Hip Joint. Even I can't sit. But It is important to me.
Anonymous
breaks rule 3
Sorry for that
Anonymous
Plz help me.
Anonymous
Plz help me.
just google what you want with "demo github" at the end. also that's rule 2
Anonymous
Anonymous
If I can't find whatever I want then what should I do?
i sent the message after doing the googling 🤷
Anonymous
Thanks man
ברני
#include<stdio.h> #include <math.h> int main() { double num1, num2, counter=0; printf("Please enter 2 numbers for deviation:\n"); scanf("%lf %lf", &num1, &num2); while(num1>=num2){ num1-=num2; counter++; } printf("%lf", num1); return 0; }
ברני
Question, why on some compilers it runs fine, and in others it returns 0?
ברני
BTW math.h is not necessary here right?
Pavel
BTW math.h is not necessary here right?
Not necessary. What input do you give it to reproduce the issue?