Hello again! lol. I have to create a fold utility program as our final project (we had 3 choices). I am having trouble getting started on it. I will post a link to the description of what the fold command is supposed to do.
http://www.conestogac.on.ca/~set/cou..._fold_2008.htm
This is due on Tuesday btw.
UPDATE: So far I have this...
I guess that separate functions would be a good idea to use for each command line argument?Code:#include <stdio.h>
int main(int argc, char *argv[])
{
FILE *inputFile; //pointer to a file//
if (argv[1] == '-s')
{
// Fold line after the last blank character within the first width column positions.
// If there is no such character, fold anyway.
}
if (argv[2] == '-w' && argv[3] == /* width variable here*/)
{
// Specify a line width to use instead of the default 80 columns.
}
inputFile = fopen(argv[4], "r"); //open a file for reading//
if (inputFile = fopen(argv[4], "r") == NULL)
{
printf("Cannot open file for reading.\n"); //display error if file is not found//
return -1;
}
if (inputFile = fopen(argv[4], "r") != NULL)
{
return -2;
}
//other code here//
return 0;
}