I'm porting a relatively simple console program written for Unix to the Windows platform (Visual C++ 8.0). All the source files include "unistd.h", which doesn't exist. Removing it, I get complaints about misssing prototypes for 'srandom',…
After having installed libpng into my computer, I've included it into my project using #include on a Windows 7 SP1 plateform and using Visual Studio Ultimate 2013.
But at build time, I'm getting this error:
C1083: Cannot open include file:…
i have vlc (program to reproduce videos)
if i type in a shell:
/home/vlc "/home/my movies/the movie i want to see.mkv"
it opens up an reproduces the movie.
however, when I run the following program:
#include
int main(void) {
…
Using OS X 10.10.2, I download Clang for Mac OS X v. 3.6.0, and try to compile a simple Hello World program.
The commands I use are these:
(assumes you downloaded clang to .)
cd .
./clang+llvm-3.6.0-x86_64-apple-darwin/bin/clang++ main.cpp
The…
I have come across this particular snippet of code many times in solutions of competitive programming contests. I understand the basic use of this code to beat time limits but i want to understand it more deeply. I know that unistd.h gives access to…
When including the sleep function from unistd.h the program hangs indefinitely:
#include
#include
int main()
{
int i;
printf("0 ");
for(i = 1; i <20; ++i)
{
sleep(2);
…
What is the difference between fsync and syncfs ?
int syncfs(int fd);
int fsync(int fd);
The manpage for fync says the following :
fsync() transfers ("flushes") all modified in-core data of (i.e., modified buffer cache pages
for) the…
When I have searched for the header unistd.h, in The Open Group, I found that it contains the standard symbolic constants & types and for sys/types.h it said for data types.
Then I found that both have uid_t, pid_t and several similar types.
I am…
As normal C++ execl works fine (compiling with g++ ok.cc -o ok.elf)
#include
int main(){
execl("/usr/bin/python", "/usr/bin/python", nullptr);
}
But crashes, when works as node.js C++ addon
#include
#include…
I'm trying to use redirects in C to redirect input to one file and then set standard output back to print to the screen. Could someone tell me what's wrong with this code?
#include
#include
#include
int main(int argc,…
I am trying to implement my own version of clock() using asm and rdtsc. However I am quite unsure about its return value. Is it cycles? Oder is it micro seconds?
I am also confused about CLOCKS_PER_SEC. How can this be constant?
Is there any kind…
I am getting the following warning when I compile:
execute.c:20:2: warning: implicit declaration of function ‘execvpe’[-Wimplicit-function-declaration] execvpe("ls", args, envp);
^
My understanding is that this occurs when the function you are…
I was trying to look up the prototype for the getpgrp() function in unistd.h but couldnt find it. The only line containing getpgrp in that file was the line libc_hidden_proto (tcgetpgrp) and I'm assuming this is a macro, but I dont know what it…
I'm currently struggling with clang++, and after looking on the web for a long time I decided asking my question. I'm on OS X and using clang++ via Emacs (it's used by flycheck to highlight errors, among other things). I have a very simple file that…
I have used syscalls read() and write() in my program WITHOUT including "unistd.h" header file in the program. But still the program works and gives expected results.
After running the program, i thought i will read the man page for read() and…