自己写的detab函数
来源:互联网 发布:美国网站域名后缀 编辑:程序博客网 时间:2024/05/18 10:20
#include <stdio.h>#include <stdlib.h>#define MAXN1 1000#define MAXN2 2000void record(char *s);void changeInput(char *input,char *output);/* run this program using the console pauser or add your own getch, system("pause") or input loop */char input[MAXN1];char output[MAXN2];int main(int argc, char *argv[]) {record(input);//printf("%s",input);changeInput(input,output);printf("array is %s",output);return 0;}void record(char *s){char c;while((c=getchar())!='%'){*s=c;s++;}*s='\0';}//printf("%c",c);void changeInput(char *input,char *output){//char *place=NULL;//char *first=NULL;//first=place;//printf("first1=%d",first);//printf("place1=%d",place);while(*input!='\0'&&*input!='\t'){*output=*input;//printf("%c",*output);output++;/*if(*input=='\t'){if(ok1==1){place1=input;ok1=0;}else if(ok2==1){place2=input;ok2=0;}else{addBlank(input,output,place1,place2);ok2=1;}}*/input++; }/*if(*input=='%'){*outputint distance=input-first;while(distance--){input--;}while((*output=*input)!='%'){input++;output++;}*output='\0';}else*///input--;if(*input=='\t'){char *place=NULL;place=input;//printf("place1=%d",place);while(*input!='\0'){if(*input=='\t'){//printf("place2=%d",place);int distance;distance=input-place;//printf("distance=%d",distance);while(distance--){*output=' ';output++;}while(place!=input){*output=*place;place++;output++;}}input++;}}*output='\0';//printf("%s",output);}
注意1赋值的变量对不对
2注意指针在函数第一次调用时又会变成初值
0 0
- 自己写的detab函数
- 书本上的detab函数
- 带命令行参数的detab函数
- 自己写的日志函数
- 自己写的trim函数
- 自己写的printf函数
- 自己写的函数归纳
- 自己写的atoi函数
- 自己写的几个函数
- 自己写的matlab的svd函数
- 自己写的分割字符串的函数
- 自己写的php移动文件夹函数
- 自己写的几个字符串函数
- 自己写的excel导入sqlserver函数
- 自己写的excel导入sqlserver函数
- 自己写的excel导入sqlserver函数
- 自己写的一些Delphi常用函数
- 自己写的两个Excel 函数
- 窗口重绘一点通
- 第十六周项目2-用指针玩字符串(连接字符串)
- 如何设置JTable不可编辑
- BDTC2014中国大数据技术大会 会议记录
- C语言大世界—————09指针类型之函数指针+函数别名 福利篇
- 自己写的detab函数
- Linux epoll工作原理
- linux0.11任务切换switch_to
- 面向对象与面向过程小结
- JScrollPane,JTable
- asm磁盘管理
- 第十六周项目2-用指针玩字符串(去除字符串中的特定字符)
- form中的button按钮在IE11中自动提交表单问题导致弹出框关闭之后表单被重置
- 黑马程序员之ios学习总结——12 OC语言的内存管理2