C Programming Program Lab Report

Description

Write a C program that looks in the current directory for files whose name matches the pattern “numbers.XXXX” where XXXX is a set of 4 numbers. For each file, open the file and read the file. You can assume that the file will contain 100 integers. Sum the integers. Print the filename and the sum of the integers.

Hints:

  • Make a function to deal with open/read/sum/print/close.
  • opendir() requires a starting directory. You want to start where in the current directory.
  • You need to loop over the directory entries. This is similar to walking a linked list.
  • You want to check every file entry to see if it starts with “numbers.”
  • Get your college paper done by experts

    Do my question How much will it cost?

    Place an order in 3 easy steps. Takes less than 5 mins.

    0 replies

    Leave a Reply

    Want to join the discussion?
    Feel free to contribute!

    Leave a Reply

    Your email address will not be published. Required fields are marked *