How do you populate a file with with five zeros going vertically? and
How do you print out the file's inode number and size in bytes one the above has been created?
This is the first stage of a darts program. The first file would contain zero's 5 of them becasue there are 5 players. The thing is, I don't know how to do it. below is my tried attempt sort of:
for (i=5; i<scores; i++)
write(fd, &scores, sizeof (int));
also how do i do the i node number i have no idea about this?
the rest of my coding which so far does, accepts the filename from command line and create the file with read and write for owner.
Code:#include<stdio.h>
#include<string.h>
#include<errno.h>
int main (int argc, char *argv[])
int scores;
if (argc !=2) {
printf("Usage: %s scores\n", argv[0]);
exit(1);
fd = open("scorefile", 0_RDWR | 0_CREAT, 0600);
if (fd<0) {
perror("cannot open file score");
exit(2);