#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void Writing()
{
int n, i, chars;
FILE *fp;
fp = fopen("array.txt", "wb");
int arr[10];
if(fp == NULL)
{
printf("Error\n");
exit(1);
}
printf("Enter the number of records you want to enter: ");
scanf("%d", &n);
for(i = 0; i < n; i++)
{
fflush(stdin);
scanf("%d",&arr[i]);
fwrite(arr, n, 1, fp);
}
fclose(fp);
}
void Reading()
{
int num;
FILE *myFile;
myFile = fopen("C:\\Users\\User\\Pictures\\array.txt","r");
int numberArray[6];
int i;
if (myFile == NULL){
printf("Error Reading File\n");
exit (0);
}
for (i = 0; i < 6; i++){
fscanf(myFile, "%d,", &numberArray[i] );
}
for (i = 1; i < 6; i++){
printf("%d ", numberArray[i]);
}
fclose(myFile);
}
int main(int argc,char** argv)
{
printf("%s\n",argv[0]);
//Reading();
Writing();
return 0;
}