-
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.
Merge branch 'master' of https://github.com/LawrenceXavier/HDH_Project
- Loading branch information
Showing
17 changed files
with
430 additions
and
28 deletions.
There are no files selected for viewing
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,2 @@ | ||
Hello, is it me you looking for? | ||
I can see it in your eyes... |
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
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
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
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
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
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
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
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,26 @@ | ||
#include "syscall.h" | ||
|
||
#define MAX_LEN 255 | ||
#define BUF_LEN 255 | ||
|
||
char file_name[MAX_LEN + 1]; | ||
char buf[BUF_LEN + 1]; | ||
|
||
int main() | ||
{ | ||
int charRead, charWritten; | ||
int fid; | ||
PrintString("Nhap ten file: "); | ||
ReadString(file_name, MAX_LEN); | ||
|
||
fid = Open(file_name, 1); | ||
while ((charRead = Read(buf, BUF_LEN, fid)) > 0) { | ||
charWritten = Write(buf, charRead, 1); | ||
if (charRead != charWritten) { | ||
PrintString("Loi khi hien thi file.\n"); | ||
Halt(); | ||
} | ||
} | ||
Close(fid); | ||
Halt(); | ||
} |
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,47 @@ | ||
#include "syscall.h" | ||
|
||
#define MAX_LEN 256 | ||
|
||
char s_name[MAX_LEN + 1], d_name[MAX_LEN + 1]; | ||
char buf[MAX_LEN + 1]; | ||
|
||
int main() | ||
{ | ||
int s_fid, d_fid; | ||
int charCount, charWritten; | ||
PrintString("Nhap file nguon: "); | ||
ReadString(s_name, MAX_LEN); | ||
PrintString("Nhap file dich: "); | ||
ReadString(d_name, MAX_LEN); | ||
|
||
s_fid = Open(s_name, 1); | ||
if (s_fid == -1) { | ||
PrintString("Loi khi mo file nguon.\n"); | ||
Halt(); | ||
} | ||
|
||
if (CreateFile(d_name) == -1) { | ||
PrintString("Loi khi tao file dich.\n"); | ||
Halt(); | ||
} | ||
|
||
d_fid = Open(d_name, 0); | ||
if (d_fid == -1) { | ||
PrintString("Loi khi mo file dich.\n"); | ||
Halt(); | ||
} | ||
|
||
while ((charCount = Read(buf, MAX_LEN, s_fid)) > 0) { | ||
charWritten = Write(buf, charCount, d_fid); | ||
if (charCount != charWritten) { | ||
PrintString("Loi trong qua trinh copy file.\n"); | ||
Halt(); | ||
} | ||
} | ||
|
||
if (charCount == -1) | ||
PrintString("Loi trong qua trinh doc file.\n"); | ||
else | ||
PrintString("Copy file thanh cong.\n"); | ||
Halt(); | ||
} |
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,19 @@ | ||
#include "syscall.h" | ||
|
||
#define BUF_LEN 255 | ||
|
||
char buf[BUF_LEN + 1]; | ||
|
||
int main() | ||
{ | ||
int charCount = 0, charWritten; | ||
while ((charCount = Read(buf, BUF_LEN, 0)) > 0) { | ||
buf[charCount++] = '\n'; | ||
charWritten = Write(buf, charCount, 1); | ||
if (charWritten != charCount) { | ||
PrintString("Error when printing to console.\n"); | ||
break; | ||
} | ||
} | ||
Halt(); | ||
} |
Oops, something went wrong.