Hi, I been trying to get my head around storing data from the command line to a file, but really cant get my head round this, havent really done c before and learning it slowly but as fast as I can.. PLEASE IF YOU COULD GIVE ME A HAND ON HOW I CAN PRODUCE WHAT IS REQUIRED OR GIVE ME A CLUE ON HOW I COULD TACKLE VARIOUS PARTS EG.USING AN IF STATEMENT ETC.. ON THE QUOTE UNDERNEATH WOULD BE VERY GREATFUL..


The programs demonstrate the use of low-level file handling system calls. You must write a set of programs which provide a scoring facility for a game of darts. The first player to reach a score of exactly 250 will be deemed the winner. The program should support 5 players (though a game might involve as few as 2 players).

The scores will be stored in a file of 5 integer numbers, each representing the score of the corresponding player. You must therefore write an initial program to create and initialize this file. This program should:

accept the file name from the command line
create the file with RW permissions for owner
populate it entirely with zeroes (of which there should be 5, one for each player)
print out the file's inode number and size in bytes once it has created it

You must then write a program that records the scores. Note that the quality of user interface is not an important factor, so it is recommended that it is kept simple. The program should be passed the number of players for the game via the command line (acceptable range is 2 to 5). The program should allow two operations:

a New Game can be started, which resets all scores to zero
all current scores can be displayed
a score can be entered
this is wat I have up to now, please let me know also what I am doing wrong, and why? Thanks

Code:
#include <stdio.h>  //Allows input and output of program
#include <io.h>     //Checks for existence of file

int main(int argc, char* argv[])

{

fp = fopen(argv[i], "r");
fpo = fopen(argv[i], "w");

   char* filename = NULL;     

   if( argc == 2)
       filename = argv[1];
   else
   {
       printf("Error\n");
       return 1;
   }

   return 0;
}