Új hozzászólás Aktív témák
-
Sk8erPeter
nagyúr
válasz
Szőkecica #2419 üzenetére
#include <stdio.h>
int main()
{
int bytes_read;
int nbytes = 100;
char *my_string;
puts ("Please enter a line of text.");
/* These 2 lines are the heart of the program. */
my_string = (char *) malloc (nbytes + 1);
bytes_read = getline (&my_string, &nbytes, stdin);
if (bytes_read == -1)
{
puts ("ERROR!");
}
else
{
puts ("You typed:");
puts (my_string);
}
return 0;
}"The getline function reads an entire line from a stream, up to and including the next newline character. It takes three parameters. The first is a pointer to a block allocated with malloc or calloc. (These two functions allocate computer memory for the program when it is run. See Memory allocation, for more information.) This parameter is of type char **; it will contain the line read by getline when it returns. The second parameter is a pointer to a variable of type size_t; this parameter specifies the size in bytes of the block of memory pointed to by the first parameter. The third parameter is simply the stream from which to read the line."
Új hozzászólás Aktív témák
● olvasd el a téma összefoglalót!
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- Mobil flották
- Telekom otthoni szolgáltatások (TV, internet, telefon)
- Monitortrió a Samsungtól, köztük egy 500 Hz-es QD-OLED-del
- PlayStation 5
- Háztartási gépek
- Suzuki topik
- Projektor topic
- A fociról könnyedén, egy baráti társaságban
- AMD Navi Radeon™ RX 9xxx sorozat
- Medence topik
- További aktív témák...
- Oculus Quest 2 VR szett, 128 GB hibátlan állapot, garanciás
- Dell Latitude 5320 -60% "Kis Gamer" Üzleti Profi Ultrabook 13,3" i5-1145G7 16/512 FHD IRIS Xe
- Dobozos DELL Inspiron 16 Fémházas Multimédiás Laptop 16" -40% Ryzen 7 8840U 8mag 16/1TB FHD+ IPS
- Csőtörés bemérés - Csőtörés Javítás Szakszerűen
- Professzionális vízszerelés 0-24 akár azonnali kiszállással
Állásajánlatok
Cég: FOTC
Város: Budapest