int main()
{
int len=0
int len2=0
FILE* stream
FILE* stream1
FILE* stream2
char buf[50]
char buf1[50]
char buf2[50]
char text[1024]
printf("input anfile path to open:")
scanf("铅滚%s",buf)
stream=fopen(buf,"r+")
fseek(stream,0,SEEK_END)
len=ftell(stream)
printf("the file %s length is %d!\n",buf,len)
len2 = len/2
printf("intput 2 file name: \n")
scanf("%s%s",buf1,buf2)
fseek(stream,0,SEEK_SET)
stream1=fopen(buf1,"w+")
stream2=fopen(buf2,"w+")
fread(text,len2,1,stream)
fwrite(text,len2,1,stream1)
fread(text,len-len2,1,stream)
fwrite(text,len-len2,1,stream2)
fclose(stream)
fclose(stream1)
fclose(stream2)
return 0
}
文件合并
#include<stdio.h>
int main()
{
int len=0
int len2=0
FILE* stream
FILE* stream1
char buf[50]
char buf1[50]
char text[1024]
printf("input anfile path to open:")
scanf("%s",buf)
stream=fopen(buf,"乱激唤r+")
fseek(stream,0,SEEK_END)
printf("哗凯intput another file name: \n")
scanf("%s",buf1)
stream1=fopen(buf1,"r+")
fseek(stream1,0,SEEK_END)
len=ftell(stream1)
fseek(stream1,0,SEEK_SET)
fread(text,len,1,stream1)
fwrite(text,len,1,stream)
fclose(stream)
fclose(stream1)
remove(buf1)//remove the another file
return 0
}
需要在程序目录下有文件存在
这里只仿亩讲原理,不关注速度。实际设计工作中,已经有很多单片机能够识别io端口上升沿和下降沿中断,且方式不止一种。sbit io_inp=P2^1输入端
bit old_bit输入端电平记备睁森忆
unsigned char low_high上升下降沿标志,0=无变化,1=上升沿,2、下降沿
void io_rest(void)
{
if(old_bit=!io_inp)
{
old_bit=io_inp
if(io_inp=1)
low_high=1
else
low_high=2
}
}
void main(void)
{
old_bit=io_inp=P2^1
while(1)
{
low_high=0
io_rest(void)
//早神在此应用
}
}
C语言太老了吧,你说的C语言是DOS下的C还是WINDOWS下的C,windows下的C语言可以直接调用有差顷前虚清关图像的API实现,就是太麻烦了,DOS下的C好像现在没有乎散人用来写有关图像处理的程序了吧,太老了欢迎分享,转载请注明来源:内存溢出
评论列表(0条)