top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Open system call in linux

+3 votes
59 views

I noticed that there are two prototypes for open system call in linux,

int open(const char *pathname, int flags);
int open(const char *pathname, int flags, mode_t mode);

I would like to know how the C compiler can differentiate b/w both calls, given C compiler doesn't support function overloading?

posted May 10, 2016 by Shivam Kumar Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes

Hello Shivam,
I agree with your statement that C language does not support function overloading. However, C language supports function with variable number of arguments. In this case, open system call has following syntax.
int open(const char *path, int oflag, .../*,mode_t mode */);
It is why it can be called with different set of parameters. First two parameters will be fixed based on position and other parameters can be passed at third position and so on.

answer May 10, 2016 by Neelam
Thanks
Similar Questions
+4 votes

So many times, we make foreground process to background process in linux system. How does it handle internally ?

0 votes

Can someone please explain using any example ?

+2 votes

How a background process is treated by operating system ?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...