Quick question about processes in C/C++. When I use fork() to create two processes in my main, on my child process I am calling an extern API to get a vector of bools and send it through a pipe to the parent, but when I call the API he kills right away the child process without sending the vector through the pipe first. Why do you guys think this might be happening? The code is something like this :
//main.cpp
#include "main.hpp"
int main(){
pid_t c_pid = fork();
if(c_pid == 0) {
std::cout << "Code From here implements Child process"<< std::endl;
API::Api_Get_Method(); // Child dies here
std::cout << "Finish Child process " << std::endl;
std::exit(EXIT_SUCCESS); // But should die here
}
else{
wait(nullptr)
std::cout << "Code From here implements Parent process Id : " << std::endl;
std::cout << "Finish Parent process " << std::endl;
}
}
//main.hpp
namespace API{
void Api_Get_Method(){
// Do stuff
// Print the result of the Stuff
}
}
```