Ú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!
- ÚJ ASUS TUF Gaming M4 WL Bolti ár:16k INGYEN FOXPOST
- Szinte ÚJ ASUS ROG STRIX Impact II Electro Punk Bolti ár:20k INGYEN FOXPOST
- ÚJ (Hiányos) ASUS ROG Harpe Ace Aim Lab Edition Bolti ár:40k INGYEN FOXPOST
- ÚJ ASUS ROG Strix Impact II Wireless Bolti ár:25k INGYEN FOXPOST
- Szinte ÚJ ASUS Rog Spatha X Bolti ár:60k INGYEN FOXPOST
- GYÖNYÖRŰ iPhone 14 Pro Max 256GB Space Black -1 ÉV GARANCIA -Kártyafüggetlen, MS4031
- Gamer billentyűzetek /SteelSeries/Das Keyboard/Ozone/DE/EN/
- Hutt C6 ablaktisztító robot / 12 hó jótállás
- AZONNAL KÉSZLETRŐL! AMD Ryzen 7 9800X3D 64GB 6000MHz RAM 2TB Gen4 SSD RTX 5090 32GB GDDR7 1200W
- BESZÁMÍTÁS! ASUS H510M i5 10400F 16GB DDR4 512GB SSD GTX 1060 6GB Rampage SHIVA DEEPCOOL 400W
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Laptopszaki Kft.
Város: Budapest

