Re: [Linux-programlama] C ile Komple Cümleyi Almak

---------

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

From: Recai Oktas (roktas@omu.edu.tr)
Date: Thu 05 Jan 2006 - 16:13:25 EET


* Nejat AYDIN [2006-01-05 05:13:40+0200]
> Alper KANAT wrote:
> >Ufak bir proje için C'de bir program yazmam gerekiyor. Kullanıcının
> >girdiği bir cümleyi bir array'in içine koymak istiyorum. scanf boşluk
> >karakterini almadığı için benim için sorun oluyor. gets kullandığımda
> >nedense program giriş almadan sonlanıyor.
>
> Asla ve asla gets kullanma. ASLA!

Gayet yerinde bir uyari, pekistirici olmasi icin 'info libc "Line Input"'
ile ulasilabilecek "GNU C Library" uyarisi:

 - Deprecated function: char * gets (char *S)
     The function `gets' reads characters from the stream `stdin' up to
     the next newline character, and stores them in the string S. The
     newline character is discarded (note that this differs from the
     behavior of `fgets', which copies the newline character into the
     string). If `gets' encounters a read error or end-of-file, it
     returns a null pointer; otherwise it returns S.

     *Warning:* The `gets' function is *very dangerous* because it
     provides no protection against overflowing the string S. The GNU
     library includes it for compatibility only. You should *always*
     use `fgets' or `getline' instead. To remind you of this, the
     linker (if using GNU `ld') will issue a warning whenever you use
     `gets'.

-- 
roktas
_______________________________________________
Linux-programlama mailing list
Linux-programlama@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama


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

---------

Bu arsiv hypermail 2.1.2 tarafindan uretilmistir.