[linux-yazilim] Re: fopen binary file

---------

New Message Reply About this list Date view Thread view Subject view Author view

From: Haci Huseyin Ekemen (h2e@bilmuh.ege.edu.tr)
Date: Mon 16 Sep 2002 - 20:52:26 EEST


h h 2222222 eeeeeee
h h 2 e
hhhhhhh 2222222 eeeeeee
h h 2 e
h h 2222222 eeeeeee

On Sat, 14 Sep 2002 sbolukbas@darkstar.securities.com.tr wrote:

>
> FILE *dosya;
> dosya = fopen("dosya.bin", "rb");
>
> seklinde binary bir dosyayi acip okuma yapmak istiyorum.
> while ((ch = fgetc(dosya)) != EOF)
> seklindeki bir dongu dosya sonuna gelmeden, ch'nin -1 almasiyla sona
> eriyor. Dosya sonunu binary dosyalarda tespit edebilecegim bir komut
> varmi?
>
> Saygilarimla ...
>
>
  #include<stdio.h>
  FILE *x;
   
   int main()
     {
      signed char a;
         
         x=fopen("/bin/ping","rb");
           if(x==-1) {
                 puts("eror in fopen");
                 exit(1);

              }
         
        while((a=(signed char)fgetc(x))!=-1) putc(a);

      }
   bu code gayet iyi bir sekilde dosya sonunu getiriyor.
   ==NULL ifadesi genelde adres oparetion larinda kullanilir.zaten man
   fgetc de de tgetc fonk. int deger return yapiyor....
   ayni zamanda NULL==0 dir.
   


New Message Reply About this list Date view Thread view Subject view Author view

---------

Bu arsiv hypermail 2b29 tarafindan uretilmistir.