Write a program to open, read and write files and perform file copy operation. This program show how to open, read, write and copy files using Linux or Unix system calls like open(), read() and write().
#include<stdio.h>
#include<fcntl.h>
main()
{
Information about resetting and configuring Mobile phones (Java, Android, Symbian etc), educational articles especially for programming in C, C++ and Java and more about Computers and operating systems
C Program to Open, Read and Write a file using System Calls
This is a C program to open , read and write files using system calls in Linux (UNIX) operating systems. The system calls open(), read() and write() are used in the C program to open, read and write files in Unix/Linux operating systems.
#include<stdio.h>
#include<fcntl.h>
main()
{
#include<stdio.h>
#include<fcntl.h>
main()
{
Using System calls in C Program to rename a Directory in Linux
C Program to rename a directory in Unix or Linux operating systems using system call rename().
#include<stdio.h>
main()
{
#include<stdio.h>
main()
{
Labels:
$ccpp
,
c program
,
code
,
compiled
,
directory
,
How to
,
lab
,
Linux
,
operating Systems
,
OS
,
OS lab
,
programming
,
rename
,
source code
,
system call
,
UNIX
How to Create process and display Process ID (pid) of Both Parent and Child
This program shows how to create process and display Process ID (pid) of Both Parent and Child processes. The process is created using the fork system call in UNIX (Linux) operating systems.
#include<stdio.h>
#include<dirent.h>
main(int argc,char **argv)
{
#include<stdio.h>
#include<dirent.h>
main(int argc,char **argv)
{
Labels:
$ccpp
,
c program
,
code
,
compiled
,
create
,
display
,
fork
,
getpid
,
lab
,
Linux
,
operating Systems
,
OS
,
Oslab
,
process
,
process id
,
programming
,
source code
,
system call
,
UNIX
How to use fork and exec System Call
Using fork and exec System calls in Linux (UNIX) operating systems. Fork system call is used to create a child process from a parent process.
#include<stdio.h>
main()
{
#include<stdio.h>
main()
{
How to use exit() System call
C program to show how to use exit system call. The function exit() is used to exit from a process (or to terminate a process). This works both in Linux or UNIX and Windows operating systems.
#include<stdio.h>
main()
{
#include<stdio.h>
main()
{
Labels:
$ccpp
,
c program
,
code
,
compiled
,
exit
,
lab
,
Linux
,
operating Systems
,
OS
,
programming
,
source code
,
system call
,
UNIX
,
Windows
How to make parent process wait till Completion of Child Process (Joining parent with child process)
How to make the parent process wait till the completion of execution of child process. The following C program makes the parent process to wait till the completion of its child process.
#include<stdio.h>
main()
{
#include<stdio.h>
main()
{
How to make Child process an Orphan Process
C program in Linux or Unix to make a child process orphan:
Making child as orphan
#include<stdio.h>
main()
{
Making child as orphan
#include<stdio.h>
main()
{
C Program to Show Process ID in Linux
This program is to show the process id (pid) in UNIX or Linx
The system call getpid() returns the process id of current process.
#include<stdio.h>
int main()
{
printf("\n Parent Process ID %d",getppid());
}
The system call getpid() returns the process id of current process.
#include<stdio.h>
int main()
{
printf("\n Parent Process ID %d",getppid());
}
Subscribe to:
Posts
(
Atom
)