-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa08a13
commit f0029d7
Showing
27 changed files
with
669 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
C programming is native programming languageLogic Building |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
C programming is native programming languageLogic Building |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
C programming is native programming languageLogic Building |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
C programming is native programming languageLogic Building |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<fcntl.h> | ||
|
||
int main() | ||
{ | ||
char Fname[20]; | ||
int fd = 0; | ||
|
||
printf("Enter the file name you want to create : "); | ||
scanf("%s",Fname); | ||
|
||
fd = creat(Fname,0777); | ||
|
||
if(fd == -1) | ||
{ | ||
printf("Unable to create file\n"); | ||
} | ||
else | ||
{ | ||
printf("File is successfully created with FD %d\n",fd); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<fcntl.h> | ||
|
||
int CreateFile(char Name[]) | ||
{ | ||
int fd = 0; | ||
fd = creat(Name,0777); | ||
return fd; | ||
} | ||
|
||
int main() | ||
{ | ||
char Fname[20]; | ||
int fd = 0; | ||
|
||
printf("Enter the file name you want to create : \n"); | ||
scanf("%s",Fname); | ||
|
||
fd = CreateFile(Fname); | ||
|
||
if(fd == -1) | ||
{ | ||
printf("Unable to create file\n"); | ||
} | ||
else | ||
{ | ||
printf("File is succcessfuly created with FD %d\n",fd); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<fcntl.h> | ||
|
||
// O_RDONLY Open for reading | ||
// O_WRONLY Open for writing | ||
// O_RDWR Open for reading and writing | ||
int main() | ||
{ | ||
char Fname[20]; | ||
int fd = 0; | ||
|
||
printf("Enter the file name you want to open : \n"); | ||
scanf("%s",Fname); | ||
|
||
fd = open(Fname,O_RDWR); | ||
|
||
if(fd == -1) | ||
{ | ||
printf("Unable to open file\n"); | ||
} | ||
else | ||
{ | ||
printf("File is succcessfuly opened with FD %d\n",fd); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<fcntl.h> | ||
|
||
int OpenFile(char Name[]) | ||
{ | ||
int fd = 0; | ||
fd = open(Name,O_RDWR); | ||
return fd; | ||
} | ||
|
||
int main() | ||
{ | ||
char Fname[20]; | ||
int fd = 0; | ||
|
||
printf("Enter the file name you want to open : \n"); | ||
scanf("%s",Fname); | ||
|
||
fd = OpenFile(Fname); | ||
|
||
if(fd == -1) | ||
{ | ||
printf("Unable to open file\n"); | ||
} | ||
else | ||
{ | ||
printf("File is succcessfuly opened with FD %d\n",fd); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<fcntl.h> | ||
#include<unistd.h> | ||
|
||
int main() | ||
{ | ||
char Fname[20]; | ||
int fd = 0; | ||
char Data[] = "Marvellous"; | ||
printf("Enter the file name you want to open : \n"); | ||
scanf("%s",Fname); | ||
|
||
fd = open(Fname,O_RDWR); | ||
|
||
if(fd == -1) | ||
{ | ||
printf("Unable to open file\n"); | ||
} | ||
else | ||
{ | ||
printf("File is succcessfuly opened with FD %d\n",fd); | ||
write(fd,Data,10); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<fcntl.h> | ||
#include<unistd.h> | ||
#include<string.h> | ||
|
||
int main() | ||
{ | ||
char Fname[20]; | ||
int fd = 0 , Length = 0; | ||
char Data[100]; | ||
|
||
printf("Enter the file name you want to open : \n"); | ||
scanf("%s",Fname); | ||
|
||
fd = open(Fname,O_RDWR); | ||
|
||
if(fd == -1) | ||
{ | ||
return -1; | ||
} | ||
|
||
printf("Enter the data that you want to write in file : \n"); | ||
scanf(" %[^'\n']s",Data); | ||
|
||
Length = strlen(Data); | ||
|
||
//write(kashyat,kay,kiti); | ||
write(fd,Data,Length); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<fcntl.h> | ||
#include<unistd.h> | ||
#include<string.h> | ||
|
||
int main() | ||
{ | ||
char Fname[20]; | ||
int fd = 0 , Length = 0; | ||
char Data[100]; | ||
|
||
printf("Enter the file name you want to open : \n"); | ||
scanf("%s",Fname); | ||
|
||
fd = open(Fname,O_RDWR | O_APPEND); | ||
|
||
if(fd == -1) | ||
{ | ||
return -1; | ||
} | ||
|
||
printf("Enter the data that you want to write in file : \n"); | ||
scanf(" %[^'\n']s",Data); | ||
|
||
Length = strlen(Data); | ||
|
||
//write(kashyat,kay,kiti); | ||
write(fd,Data,Length); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<fcntl.h> | ||
#include<unistd.h> | ||
#include<string.h> | ||
|
||
int main() | ||
{ | ||
char Fname[20]; | ||
int fd = 0 , Length = 0; | ||
char Data[100]; | ||
|
||
printf("Enter the file name you want to open : \n"); | ||
scanf("%s",Fname); | ||
|
||
fd = open(Fname,O_RDWR); | ||
|
||
if(fd == -1) | ||
{ | ||
return -1; | ||
} | ||
|
||
//read(kuthun,kashat,kiti); | ||
read(fd,Data,13); | ||
|
||
printf("Data from file is %s",Data); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<fcntl.h> | ||
#include<unistd.h> | ||
#include<string.h> | ||
|
||
int main() | ||
{ | ||
char Fname[20]; | ||
int fd = 0 , Length = 0; | ||
char Data[100]; | ||
|
||
printf("Enter the file name you want to open : \n"); | ||
scanf("%s",Fname); | ||
|
||
fd = open(Fname,O_RDWR); | ||
|
||
if(fd == -1) | ||
{ | ||
return -1; | ||
} | ||
|
||
//read(kuthun,kashat,kiti); | ||
Length = read(fd,Data,13); | ||
|
||
printf("Data from file is \n"); | ||
write(1,Data,Length); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<fcntl.h> | ||
#include<unistd.h> | ||
#include<string.h> | ||
|
||
int main() | ||
{ | ||
char Fname[20]; | ||
int fd = 0 , Length = 0; | ||
char Data[100]; | ||
|
||
printf("Enter the file name you want to open : \n"); | ||
scanf("%s",Fname); | ||
|
||
fd = open(Fname,O_RDWR); | ||
|
||
if(fd == -1) | ||
{ | ||
return -1; | ||
} | ||
|
||
//read(kuthun,kashat,kiti); | ||
Length = read(fd,Data,13); | ||
|
||
printf("Data from file is \n"); | ||
write(1,Data,Length); | ||
|
||
close(fd); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<fcntl.h> | ||
#include<unistd.h> | ||
#include<string.h> | ||
|
||
int main() | ||
{ | ||
char Fname[20]; | ||
int fd = 0 , Length = 0; | ||
char Data[100]; | ||
|
||
printf("Enter the file name you want to open : \n"); | ||
scanf("%s",Fname); | ||
|
||
fd = open(Fname,O_RDONLY); | ||
|
||
if(fd == -1) | ||
{ | ||
printf("Unable to open file \n"); | ||
return -1; | ||
} | ||
|
||
while((Length = read(fd,Data,sizeof(Data))) != 0) | ||
{ | ||
write(1,Data,Length); | ||
} | ||
|
||
close(fd); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<fcntl.h> | ||
#include<unistd.h> | ||
#include<string.h> | ||
|
||
int main() | ||
{ | ||
char Fname[20]; | ||
int fd = 0 , Length = 0; | ||
char Data[100]; | ||
int Size = 0; | ||
|
||
printf("Enter the file name you want to open : \n"); | ||
scanf("%s",Fname); | ||
|
||
fd = open(Fname,O_RDONLY); | ||
|
||
if(fd == -1) | ||
{ | ||
printf("Unable to open file \n"); | ||
return -1; | ||
} | ||
|
||
while((Length = read(fd,Data,sizeof(Data))) != 0) | ||
{ | ||
Size = Size + Length; | ||
} | ||
|
||
printf("Size of File is %d bytes\n",Size); | ||
|
||
close(fd); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.