Questions tagged [unistd.h]

unistd.h is a C/C++ header files contains needed to provide access to the POSIX operating systems

Links:

https://en.wikipedia.org/wiki/Unistd.h

https://pubs.opengroup.org/onlinepubs/009695399/basedefs/unistd.h.html

175 questions
-1
votes
1 answer

Some man pages not found

Ubuntu 12.04... I had fedora a couple of years back and I saw the man pages for the following there... unistd.h, sys/types.h, standard typedefs (suffixed by "_t") etc. I tried this... man unistd But it didn't find it :( I think those pages are not…
Sam
  • 1,842
  • 3
  • 19
  • 33
-2
votes
3 answers

How to pause the C program?

Fixed system("read -r -p \"Press any key to continue...\" key") I am now writing a command line tool and using C language, but I am wondering how to pause the program? (Not abort it, but can be re-continued) I was trying to make it like "Press…
Coder BTS
  • 13
  • 1
  • 6
-2
votes
1 answer

Implementing a custom unistd.h for windows to work on Visual Studio - problems

I've inherited source code for a dll file that was originally written for linux. I'm using windows and visual studio and a change to linux is a no can-do, unfortunately. In particular, one of the classes requires unistd.h. Since windows does not…
Martin K
  • 43
  • 6
-2
votes
2 answers

Using chdir() Causes Segmentation Fault

I'm writing a batch emulator as a personal project. I'm trying to implement the cd command using chdir() from unistd.h. However, using this causes a segfault. main.cpp: #include #include #include #include…
Kookerus
  • 506
  • 2
  • 7
  • 18
-3
votes
0 answers

execve() always fails even with PATH set

Im trying to use execve() with set variables, but i tried using getenv() and setting HOME at the start and it never works #include #include #include #include int main( ){ char *args[] = {…
AGEERRTT
  • 7
  • 1
-3
votes
4 answers

Why this code freezes, when i'm trying to use write (man 2 write) function?

I'm trying to write test, in which some data should be read from file descriptor, so i'm using dup and pipe functions to check this. int main() { char *line; int out; int p[2]; char *str; int len = 50; …
Vladimir
  • 294
  • 1
  • 3
  • 10
-3
votes
1 answer

Read from stdin until EOF

I am having trouble reading from stdin constantly until CTRL+D is pressed. I have to use read() from unistd.h. I am trying to simulate the cat function. Is there a way to make my buffer (which I print with %s) to look neat without the unnecessary…
Alex
  • 389
  • 1
  • 2
  • 14
-3
votes
1 answer

Error code in C

I am having error with my code below #include #include #include int main() { int i, status; pid_t child; child=fork(); if(child == 0){ for(i=0; i<10; i++){ …
adadeh
  • 185
  • 1
  • 1
  • 7
-5
votes
1 answer

Sleep() Function not timing properly in C

I've been coding some simple things such as printing statements but I wanted to have my processor sleeping to not have too many printing statements at the same time. I've used the library unistd.h and used the function sleep(). The problem I have…
Paul Banus
  • 27
  • 7
-5
votes
1 answer

C: unable to print from file

So I have this project where I need to open a file and print the contents in C, but I have to use unix system calls. However I'm not to clear as to why nothing prints. I try to run the code, but it seems to skip straight to the close error. I'm…
1 2 3
11
12