Új hozzászólás Aktív témák
-
Lortech
addikt
válasz
Szőkecica
#2419
üzenetére
Ha windowson vagy, akkor a nem szabvány gnu kiterjesztés getline problémás lesz, meg lehet, hogy a főiskolán, egyetemen se fogadják el.
Egyébként a programkód megnyomása ennyit szúr be a szövegdobozba, ha kézzel bemásolod:
[M][ C ][ /C ][/M]
S így használhatod:
[M][ C ]formázandó programkód[ /C ][/M]A [ C ]-knél a space-t ki kell venni.
-
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!
- 27% - LG UltraGear 27GS93QE-B OLED Monitor! 2560x1440 / 240Hz / 0.03ms / G-SYNC / FreeSync
- Intel Core i5-13400F
- ASUS Crosshair Hero VI WiFi x370 + AMD Ryzen 5 2600X/5500 (hűtővel)
- LianLi TL LCD 120 Wireless fekete és fehér eladó
- Samsung Galaxy S25 Ultra 512GB + Galaxy Watch 8 + tokok, szíjak, fóliák
- Amazon Kindle 10th Generation ébresztős tok
- Honor X7b 128GB, Kártyafüggetlen, 1 Év Garanciával
- Honor Pad 8 / 6/128GB / Wi-fi / 12Hó Garancia
- í kilenc! AKCIÓS PRECÍZIÓS KÉSZÜLÉK! 7560 i9-11950H 32GB RAM 1TB SSD Nvidia RTX A3000 6GB 1 év gar
- Akciós kisWorkstation! Dell Precision 3570 i7-1255U 4.7GHz / 16GB / 512GB / Quadro T550 4GB FHD 15"
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest


