C项目 [英] Project in C

查看:44
本文介绍了C项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我必须在C中创建一个项目,它将使C中的MS DOS移动命令
i已经完成了这个并且这会复制文件但是我不能使代码粘贴它也可以......有人可以帮我吗?


#include< stdio.h>

#include< string.h>


int main(int argc,char * argv []){

FILE * alfa;

FILE * tempf;

FILE * vita;

char c,name [15],name2 [15];

int i = 0;


if(argc< 3){

printf(" \\\
\ n");

返回1;

}


strcpy(name,argv [1]);

strcpy(name2,argv [2]);



while(name [i]!=''\'''){

if(name [i] ==''_''){

name [i] ='''';

i ++;

}

else {

name [i] = name [i];

i ++;

}

}


i = 0;


而(name2 [i]!=''\'''){

if(name2 [i] ==''_''){

name2 [i] ='''';

i ++;

}

else {

name2 [i] = name2 [i];

i ++;

}

}


alfa = fopen(name," r");



>
tempf = fopen(temp,w);


while((c = fgetc(alfa))!= EOF)

fputc(c,tempf);


fclose(tempf);

fclose(alfa);

删除(姓名);


tempf = fopen(" temp"," r");

vita = fopen(name2," ; w");

while((c = fgetc(tempf))!= EOF)

fputc(c,vita);



fclose(tempf);

删除(" temp");

fclose(vita);




返回0;


}

解决方案

复制文件顶部是一个数组。


粘贴只是将数组复制到任何你想要的地方。

我不明白你的意思.....


我想4emens要问的是:如果文件被复制,如何复制文件然后通过gui粘贴/删除可执行文件。或者是周围的其他方式?将程序粘贴/丢弃在文件上。


这可能吗?如何命名新文件?


Hello i have to make a project in C that will make MS DOS move command in C

i have done this and this does copy the file but i cant make a code to paste it too...can someone hlp me?

#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[] ){
FILE *alfa;
FILE *tempf;
FILE *vita;
char c, name[15], name2[15];
int i=0;

if (argc<3){
printf ("\n \n");
return 1;
}

strcpy(name, argv[1]);
strcpy(name2, argv[2]);


while (name[i]!=''\0''){
if (name[i]==''_''){
name[i]='' '';
i++;
}
else{
name[i]=name[i];
i++;
}
}

i=0;

while (name2[i]!=''\0''){
if (name2[i]==''_''){
name2[i]='' '';
i++;
}
else{
name2[i]=name2[i];
i++;
}
}

alfa=fopen(name,"r");



tempf=fopen("temp","w");

while ((c = fgetc (alfa)) != EOF)
fputc(c,tempf);


fclose (tempf);
fclose(alfa);
remove (name);

tempf=fopen("temp","r");
vita=fopen(name2,"w");
while ((c = fgetc (tempf)) != EOF)
fputc(c,vita);


fclose (tempf);
remove ("temp");
fclose (vita);




return 0;

}

解决方案

Copy the file top an array.

The paste is just copying that array wherever you want.


I dont understand what u mean.....


I think what 4emens is asking: How to copy a file if the file is copied and then pasted/dropped on the executable via the gui. Or is it the other way around? Pasting/dropping the program on a file.

Is this possible? How does one name the new file?


这篇关于C项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆