Hi! This is my first post in this forum. I need to write a command-line program with a single parameter, the name of a text file, and output the number of paragraphs in it. I already did the function to do this and it is working oki. If no parameter is given, or the parameter is '-h', '?' or '--help', output usage information. i already did this.. but i do not know how to continue.
thanks in advanceCode:#include <stdio.h>
#include <string.h>
int counter (char filename[30]);
FILE *fileptr;
int main(int argc, char *argv[])
{
char filename [30];
if (argv > 1)
{
strcpy (filename,argv[1]);
printf ("%d",counter(argv[1])); // counter ( ) is the function to count the paragraphs
}
else
{
printf ("help");
}
getchar();
getchar();
return 0;
}