Bu yazmış oldugum program normal array olmayan pointer kullanmayan hatta malloc bile kullanmayan bir sturucter a kullanıcıdan veri yazip daha sonra structerdaki veriyi aynen binary modda açılmış bir dosyaya aktaran bir programcik.
#include
struct data
{
int id;
char name[20];
double price;
int quantity;
}product;
void main()
{
FILE *ptr;
ptr=fopen(“data.txt”,”wb+”);
product.id=1;
char blank[2];
while(product.id!=0)
{
printf(”
Enter the product name : “);
gets(product.name);
printf(”
Enter price : “);
scanf(“%lf”,&product.price);
printf(”
Enter Quantity : “);
scanf(“%d”,&product.quantity);
printf(“Please Enter product id btw 0-100 : “);
scanf(“%d”,&product.id);
gets(blank);
fwrite(&product,sizeof(struct data),1,ptr);
}
rewind(ptr);
fread( &product, sizeof( struct data ), 1, ptr );
while ( !feof( ptr ) )
{
fread( &product, sizeof( struct data ), 1, ptr );
printf( ”
%d %s %lf %d
“, product.id,product.name,product.price,product.quantity );
}
fclose(ptr);
}
RAID Nedir? RAID, “Redundant Array of independent Disk” yani birbirinden bağımsız disklerin disk performansı yada…
Kesintisiz Güç Kaynağı Seçim Kriterleri KGK kullanımı günümüzde hem sanayide hem de küçük ofis ve…
Linux’ta Fvwm95 Pencere Yöneticisi LINUX işletim sistemi ile ilgili yazılarımızı siz değerli okuyucularımızın Türkiye’deki çeşitli…
Prof. Dr. Oktay Sinanoğlu (1935 - .... ) Profesör Doktor Oktay Sinanoğlu; dünyanın en genç…
Galois (1811 - 1832) Fransız matematikçisi Galois, 1811-1832 yılları arasında yaşadı. Abel'in çağdaşı olan bu…
Solda : Okan ERSAN Sagda : Michael Angelo 2003 yilinda Ingilterede yapilan ''THE BEST GUITARIST…