Question: in Unix Write a C program, called SIN_validate, to validate Canadian SIN numbers stored in a file. Only Unix in- put/output system calls can be

in Unix

in Unix Write a C program, called SIN_validate, to validate Canadian SINnumbers stored in a file. Only Unix in- put/output system calls can

Write a C program, called SIN_validate, to validate Canadian SIN numbers stored in a file. Only Unix in- put/output system calls can be used when reading from the file. The input file, a text file, consists of SIN numbers, one per line. Your program should open the input file and read the SIN numbers, one at a time as a string. For each SIN number, your program should check whether it is valid. Then, prints to the screen, using system call write0, the SIN number followed by either VALID, or NON VALID. You have to handle possible system call fails by printing the appropriate message, using perrorO and exiting. Synopsis: validateslN A Canadian SIN is a 9-digit string that can be validated by checking its digits, following Luhn algorithm, see https://en.wikipedia.org/wiki/social Insurance Number. ere is an example of how it works: 024462284 121212121 a SIN, digit-wise Multiplication by this number, the result is given below: 0 448642 16 4 Then, add all of the digits together (note that 16 is 1+6): 0+4+48 +642 1+6 439

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!