Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
olback107945yTry compiling with a C compiler instead. I don't know if unistd.h is available in C++.
-
It's not a c++ thing, c++ compilers work with C just fine (you may need to specify linkage properly). Maybe they don't include unistd.h in the compiler include list for precisely this reason. After all why would competitive programming code need access to Unix systems libraries?
Also, it's probably not going to do anything to the server. If Codeforces is run by even marginally competent people they'd limit the number of processes that your process can spawn and just timeout your program after a while (using ulimit etc) (also after all why would a competitive program need to fork anyway?) -
You could look up unistd.h on your dev machine, extract the relevant function prototypes and put them into your file. Then it will compile. Linkage may be the next problem though.
-
Shell command execution via a single string parameter function. Oh man I don't like unix
Related Rants
-
xjose97x19Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
Unskipp24So this happened last night... Gf: my favorite bra is not fitting me anymore Me: get a new one ? Gf: but it ...
-
sam966911Hats off to this lady .... I would have just flipped the machine
I came across this code snippet on Quora, and I tried crashing the Codeforces server (strictly for educational purposes). But this thing wouldn’t compile, either because fork() was not declared in the scope, or the file <unistd.h> was not found. I tried it on different C++ machines. What is the fix for this ?
rant
c++
fork bomb
codeforces