项目作者: CaptainDaVinci

项目描述 :
Uses C file handling functions to edit files.
高级语言: C
项目地址: git://github.com/CaptainDaVinci/File-Formatting.git
创建时间: 2017-01-08T11:44:10Z
项目社区:https://github.com/CaptainDaVinci/File-Formatting

开源协议:

下载


File-Formatting

A simple C program that takes input as text from a file, removes trailing and unnecessary blank spaces and also wraps the line after a given length.

USAGE

compile and run the main.c file as follows :

LINUX

First change the permission for build.sh file.

  1. $ chmod +x build.sh
  2. $ ./build.sh

WINDOWS

Compile the program as follows:

  1. $ gcc main.c White-Spacing.c Statistics.c pattern.c -o format

TO RUN THE FILE

  • To format a file.
    1. $ ./format <Input file-name> <Output file-name>
    2. $ ./format in.txt out.txt // in this case.
  • To find a particluar pattern in a file.
    1. $ ./format <file-name> find <string>
    2. $ ./format in.txt Programming // in this case.
  • To view the statistics of a file.
    1. $ ./format <file-name> stats
    2. $ ./format in.txt stats // in this case.

Here, “in.txt“ is the example input file, and “out.txt“ is the output file after formatting. Notice, in “in.txt“ the text is widespread and not formatted properly.

After the program finishes running, have a look at the out.txt, notice that the formatting should have been improved. The file “in.txt“ can contain any input and it would remove trailing white spaces and unnecessary white spaces between the words and also wraps line for you.

Here, “in.txt“ and “out.txt“ is just used as an example.