Public feed #727546

Mine

public text v1 · immutable
Raw Edit
·published 2007-10-06 03:23 UTC
rendered paste body
#include "header.h"

int main(int argc, char *argv[])
{
  struct args these_args;
  char ch;
  char buffer[BUFSIZE];
  int charCount;
  int nonAlphaCharCount = 0;
  int i;
  int fd_in;
  int fd_out;
  these_args = parse_input(argc, argv);
  fd_in = these_args.input_fd;
  fd_out = these_args.output_fd;
  if(fd_in != 0)
  {
    close(INPUT);
    dup(fd_in);
  }
  if(fd_out != 1)
  {
    close(OUTPUT);
    dup(fd_out);
  }
  read(fd_in, buffer, BUFSIZE);
  for(i = 0; i < strlen(buffer); i++)
  {
    if(isalpha(buffer[i]) == 0)
    {
	nonAlphaCharCount++;
    }
  }
  printf("Line you entered was %s\n", buffer);
  printf("Number of non-alphabetical Characters was %d\n", nonAlphaCharCount);
}