Skip to content
Snippets Groups Projects
Verified Commit 515d0411 authored by jD91mZM2's avatar jD91mZM2
Browse files

Hehe make environment tests work for everybody

parent 75145ab9
No related branches found
No related tags found
No related merge requests found
......@@ -2,10 +2,10 @@
#include <stdlib.h>
int main() {
puts(getenv("SHELL"));
puts(getenv("CC"));
//puts(getenv("SHELL"));
//puts(getenv("CC"));
putenv("KEK=lol");
putenv("TEST=It's working!!");
puts(getenv("KEK"));
puts(getenv("TEST"));
}
/nix/store/zqh3l3lyw32q1ayb15bnvg9f24j5v2p0-bash-4.4-p12/bin/bash
gcc
lol
It's working!!
//http://www2.cs.uregina.ca/~hamilton/courses/330/notes/unix/pipes/pipes.html
#include <stdio.h>
#include <string.h>
#include <unistd.h>
......@@ -15,25 +14,19 @@ int main()
pid = fork();
if (pid == 0) /* child : sends message to parent*/
{
puts("Child: Close Read");
/* close read end */
close(pip[0]);
puts("Child: Write");
/* send 7 characters in the string, including end-of-string */
write(pip[1], outstring, strlen(outstring));
puts("Child: Close Write");
/* close write end */
close(pip[1]);
}
else /* parent : receives message from child */
{
puts("Parent: Close Write");
/* close write end */
close(pip[1]);
puts("Parent: Read");
/* read from the pipe */
read(pip[0], instring, 7);
puts("Parent: Close Read");
/* close read end */
close(pip[0]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment