标题:C代码:makefile做文件
只看楼主
终结者C
Rank: 2
等 级:论坛游民
帖 子:34
专家分:23
注 册:2013-3-3
结帖率:100%
 问题点数:0 回复次数:0 
C代码:makefile做文件
#include <dir.h>
#include <stdio.h>
#include <string.h>

void MakeFile()
{
        int i,j;   
        FILE *fp;
        char *path;
        char *NewName;
        char disk[7][10] = {"C","D","E","F","G"};/*定义盘符数组*/
        char *addtion = ":\\";

        /* */
        for (j = 0; j<5; j++)
     {

           path = strcat(disk[j],addtion); /* 获得盘符路径 */
           chdir(path);
              for (i = 0; i<5; i++)
        {
            char tempname[] = "XXXXXX";
            system(path);
            printf("%s\n",path);
            NewName = mktemp(tempname);/*自动建立文件名*/
            fp = fopen(NewName,"w");
            fclose(fp);
        }   
        
       }
}


void main()
{

           
     

            MakeFile();   /*调用 MakeFile函数*/
           
            printf("MakeFile success!\n\n");

           
 
}
搜索更多相关主题的帖子: path void include 
2013-03-09 14:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-400259-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 2.105567 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved