有哪位高手将它改成纯C滴???
以下这个程序是递归遍历文件夹的,并且保存文件名但是里面有些譬如<unistd.h>不是c语言的东西,是linux/unix的系统调用,包含了许多 U N I X系统服务的函数原型,不知有哪位高手可以帮我改成纯C的
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include<dirent.h>
void SearchDir(char *szDir)
{
DIR *dp;
struct dirent *pDirent;
struct stat fbuf;
char szOut[256];
FILE* fp;
dp=opendir(szDir);
if(!dp)return;
chdir(szDir);
if((fp=fopen("./file.txt","w"))==NULL){
perror("fopen");
return;
}
close(1);
dup2(fileno(fp),fileno(stdout)); /*输出重定向到file.txt*/
while((pDirent=readdir(dp))){
memset(&fbuf,0x00,sizeof(fbuf));
stat(pDirent->d_name,&fbuf); /*获取目录项信息*/
/*判断是否是目录并且是"."和".."*/
if(S_ISDIR(fbuf.st_mode) && memcmp(pDirent->d_name,".",1)!=0
&& memcmp(pDirent->d_name,"..",2)!=0){
memset(szOut,0x00,sizeof(szOut));
sprintf(szOut,&quo
相关问答:
帮帮忙,谢谢~
1. Write a program to perform a topological sort on a graph.
2. Write a program to solve the single‐source shortest‐path problem (Dijkstra
algorithm).
3. Write a program ......
C/C++ code:
#include<stdio.h>
#define MAXN 26
char stack[MAXN];
int top=0;
int push(x);
int pop(p_y);
void main()
{
char mpush=3;
char *mpop;
*mpop=0;
// printf("%d\n ......
思路:要用c#生成一个播放机的播放列表的xml,例如:
<daty datys='2010-04-05' datye='2010-05-01' > //这是播放的日期段
<time times='01:12:00' timee='02:30:00'> ......
RT!
C程序设计语言第二版
C和指针
C陷阱与缺陷
C专家编程
知道这四本都很有价值,但这四本哪两本最值得深读和研究的?我想买纸质的。还是这四本都要买?
一本书先研究通了足以,知识点都是差不多的,关键看自 ......
谁能帮我把下面这些代码改成VB形式的,多谢了,急用~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[],float g ......