Ú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!
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Xiaomi 15 - kicsi telefon nagy energiával
- Jövőre jósolják a memóriahiányt, ami egy évtizedig is fennmaradhat?
- gban: Ingyen kellene, de tegnapra
- AMD Ryzen 9 / 7 / 5 / 3 5***(X) "Zen 3" (AM4)
- Assetto Corsa Competizione
- Google Pixel 10 és 10 Pro összehasonlító gyorsteszt
- Milyen TV-t vegyek?
- Gigabyte alaplap topik
- AliExpress tapasztalatok
- További aktív témák...
- Megbízható Notebook Core i5-540M , 4096 MB DDR3, 120 GB SSD, 13,3", 1366x768 (HD) Áfás számlával
- Apple Iphone 15 128Gb 92% Független kiegészítőkkel
- Xiaomi Redmi Note 13 Pro+ 5G 256GB
- BESZÁMÍTÁS! Asus H370 i5 9600K 16GB DDR4 512B SSD RTX 2060 Super 8GB Chieftec HC-10B-OP Zalman 850W
- BESZÁMÍTÁS! Gigabyte B550M R7 5700X 32GB DDR4 1TB SSD RTX 4060 TI 16GB Gamemax Brufen C3 BG 650W
- BESZÁMÍTÁS! Apple iPhone 16 Pro MAX 256GB okostelefon garanciával hibátlan működéssel
- ÚJ BONTATLAN Apple Macbook Air 15,3 M4 10C CPU/10C GPU/16GB/256GB - Égkék - HUN - mc7a4mg/a 3 év gar
- BESZÁMÍTÁS! MSI B450 R7 3800X 16GB DDR4 512GB SSD RTX 2070 SUPER 8GB ZALMAN T7 FSP 650W
- HIBÁTLAN iPhone 13 mini 256GB Midnight -1 ÉV GARANCIA - Kártyafüggetlen, MS3445, 97% Akkumulátor
- AKCIÓ! Asus ROG STRIX Z490-G Gaming WiFi alaplap garanciával hibátlan működéssel
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest