/*
* Name: TabToSpaces.c
* Function: Change a tab to five spaces.
* Created on: 2009-12-29
* Programming Language: C
* Operating system: Window XP
* Environment: DEV-C++
* Author: http://blog.csdn.net/programs
*/
#include <stdio.h>
#include <stdlib.h>
* Name: TabToSpaces.c
* Function: Change a tab to five spaces.
* Created on: 2009-12-29
* Programming Language: C
* Operating system: Window XP
* Environment: DEV-C++
* Author: http://blog.csdn.net/programs
*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char ch = 0;
FILE *infile;
FILE *outfile;
{
char ch = 0;
FILE *infile;
FILE *outfile;
infile = fopen(".\\app.c", "r+");
outfile = fopen(".\\target.c", "a+");
outfile = fopen(".\\target.c", "a+");
if (!infile || !outfile)
{
printf("Open error\n");
exit(-1);
}
{
printf("Open error\n");
exit(-1);
}
while ((ch = getc(infile)) != EOF)
{
if ('\t' == ch)
{
fputs(" ", outfile);
}
else
{
putc(ch, outfile);
}
}
close(infile);
close(outfile);
return 0;
}
{
if ('\t' == ch)
{
fputs(" ", outfile);
}
else
{
putc(ch, outfile);
}
}
close(infile);
close(outfile);
return 0;
}