dev: fix 'navigate' tester
This commit is contained in:
parent
898162121d
commit
ee94d85a8c
1 changed files with 4 additions and 5 deletions
|
@ -409,6 +409,7 @@ navigate:
|
||||||
dirent *dir_in;
|
dirent *dir_in;
|
||||||
do {
|
do {
|
||||||
dir_in = readdir(dir);
|
dir_in = readdir(dir);
|
||||||
|
if (dir_in)
|
||||||
cout << "> " << dir_in->d_name << endl;
|
cout << "> " << dir_in->d_name << endl;
|
||||||
} while (dir_in);
|
} while (dir_in);
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
@ -424,14 +425,12 @@ navigate:
|
||||||
cout << "Content:" << endl;
|
cout << "Content:" << endl;
|
||||||
int n = 1;
|
int n = 1;
|
||||||
char buf[1000];
|
char buf[1000];
|
||||||
while (n)
|
while (n > 0)
|
||||||
{
|
{
|
||||||
n = read(file, buf, 1000);
|
n = read(file, buf, 1000);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
{
|
|
||||||
cout << "read() error :(" << endl;
|
cout << "read() error :(" << endl;
|
||||||
}
|
else if (n > 0)
|
||||||
if (n > 0)
|
|
||||||
write(1, buf, n);
|
write(1, buf, n);
|
||||||
}
|
}
|
||||||
cout << "[EOF]" << endl;
|
cout << "[EOF]" << endl;
|
||||||
|
|
Loading…
Add table
Reference in a new issue