I'm trying to compile a file from my application,with this action:
- (IBAction)build:(id)sender
{
pid_t pid=fork();
int status;
if(!pid)
{
execl("/Developer/usr/bin/gcc","-o main ~/main.c");
exit(0);
}
…
First, by "windows unistd.h", I mean the example located here: "is there a replacement for unistd.h for windows?
I am attempting to massage knetfile.c so that it can be compiled for windows64. My first step was to remove the unistd.h include,…
I'm trying to do the following:
execl("/bin/grep","grep","print",fd,NULL);
where fd is a file descriptor.
So basically this should grep for "print" in the file pointed to by fd.
It doesn't seem to work although I get no compile errors/warnings.
It…
I'm trying to use the functions read() and write() from unistd.h, but whenever I try input anything, it does not work. And I am only alowed to use functions from fcntl.h and unistd.h, not those from stdio.h.
Here is my code:
#include …
I've recieved this assignment where I have to read from a file.txt(max size 4096B) four times, basically splitting it in 4 strings of equal size. I have to fill this structure(just consider field 'msg', i think the problem is there):
struct message…
what can be the reason of bad result in generating random number in C? See my code below. The result should be number between 0 - 1. But when i print random number the result is: Doba prichodu: 690522220 n-times. And yes i am using…
I have 2 programs and I'm very confused on the return of fork() in child process
The first program would call fork() and assign it to p. When p == 0, it implies child process.
// The first program
p = fork();
if (p == 0)
{
// child…
I'm writing a C++ application which converts fahrenheit to celsius and kelvin, and kelvin to celsius and fahrenheit, etc. Since it's stupid to write an interative application here, I decided to familiarize myself with the getopt function in…
I am trying to use fork with execvp to run two shell commands concurrently. I have two problems which are when I input mkdir folder1&mkdir folder2, it creates a folder named folder1 and another folder named folder2? (the question mark is included in…
I've done a C program that takes the RGB values (0-255) of a pixel of the screen knowing its position (x,y). It works in Linux, but when I try to compile it in Visual Studio (Windows), crashes because libraries X11/Xlib.h, X11/Xutil.h, unistd.h…
I have the following test.cpp file :
#include
int main()
{
return 0;
}
I just want to compile this but I still have the following :
$ g++ test.cpp
test.cpp:1:18: fatal error: unistd: No such file or directory
#include
…
I am trying to link the output of a child process into the input of a parent process; the parent process is to execute a system call or command using the child's output.
I have looked to the following threads for answer; however, I didn't quite get…
So I need to know what number a certain system call has , it says that I can check which number a systemcall has in unistd.h file but how/where can I find that file?
I'm using Qt for a project. I'll constanly read from a file with read from unistd.h, but how can i do that? I have tried to use an infinite while loop but my application crash when i do that.
PS i'm beginner when it comes to Qt and fileoperation…