K
K
korsamc2016-04-09 15:45:47
Debian
korsamc, 2016-04-09 15:45:47

System calls in Linux?

I have code, but I can't implement Link and Chown system output please help
#include
#include
#include
int main(void)
{
printf("System:\n");
printf(system("uname -n"));
printf(system("id -un"));
printf(system("uname -r"));
long d = gethostid();
printf("Host id = %li\n", d);
return 0;
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2016-04-09
@jcmvbkbc

Are you sure you understand what a " system call " is, and how it differs from calling the system function ?

I
Ivan Bogachev, 2016-04-09
@sfi0zy

It's not entirely clear what your problem is. For example, the link you need - from the mana we see that you need to connect
and call the link function, with two parameters - strings - the name of the existing file (let it be test.txt) and the new file name for the link, it looks something like this:
link("test.txt", "newlinktotest.txt");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question