#include <stdio.h>
#include <conio.h>
void main(void)
{
FILE *fp;
int i,n,num;
clrscr();
printf("Program on Creation of a File of Integers\n");
printf("\nEnter how many integers you want to store : ");
scanf("%d",&n);
fp = fopen("three.dat","w");
if (fp == NULL)
{
printf("File Opening Error\n");
exit(0);
}
printf("\nEnter %d integers : ",n);
for (i=1;i<=n;i++)
{
scanf("%d",&num);
putw(num,fp);
}
printf("\n The file \"three.dat\" is created");
fclose(fp);
printf("\nPress any key to end...");
getch();
}
#include <conio.h>
void main(void)
{
FILE *fp;
int i,n,num;
clrscr();
printf("Program on Creation of a File of Integers\n");
printf("\nEnter how many integers you want to store : ");
scanf("%d",&n);
fp = fopen("three.dat","w");
if (fp == NULL)
{
printf("File Opening Error\n");
exit(0);
}
printf("\nEnter %d integers : ",n);
for (i=1;i<=n;i++)
{
scanf("%d",&num);
putw(num,fp);
}
printf("\n The file \"three.dat\" is created");
fclose(fp);
printf("\nPress any key to end...");
getch();
}
No comments:
Post a Comment