rewinddi.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 38 行
C
38 行
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <direct.h>
void main()
{
DIR *dirp;
struct dirent *direntp;
int handle;
dirp = opendir( "\\watcom\\h\\*.*" );
if( dirp != NULL ) {
printf( "Old directory listing\n" );
for(;;) {
direntp = readdir( dirp );
if( direntp == NULL )
break;
printf( "%s\n", direntp->d_name );
}
handle = creat( "\\watcom\\h\\file.new",
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP );
close( handle );
rewinddir( dirp );
printf( "New directory listing\n" );
for(;;) {
direntp = readdir( dirp );
if( direntp == NULL )
break;
printf( "%s\n", direntp->d_name );
}
closedir( dirp );
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?