Ú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!
- Makulátlan állapotú fekete Xiaomi 15 12+12/256GB+16GB
- LG 55UR78003LK Smart Led Tv 140 cm, 4K HDR, webOS 23 ThinQ AI Garanciàlis/
- Asus Zenbook flip13 2in1 touch screen
- Dell Latitude 5450 Intel Core Ultra 5 135U 4nm 32GB DDR5 érintőképernyős laptop Dell gari 2027.09.hó
- PlayStation 4/5 kontroller analóg cseréje HALL TMR érzékelősre, 1 év garancia!!! Nincs többé drift!!
- Dell Latitude 8-11. gen i5, i7, 2-in-1 szinte minden típus csalódásmentes, jó ár, garancia
- Telefon szerviz helyben - Gyors javítás, akár 30 perc alatt!
- ÁRGARANCIA! Épített KomPhone Ryzen 7 9700X 32/64GB RAM RX 9070 16GB GAMER PC termékbeszámítással
- LG 34GS95UE - 34" Ívelt OLED / QHD 2K / 240Hz & 0.03ms / 1300 Nits / NVIDIA G-Sync / AMD FreeSync
- Samsung Galaxy Tab A8 (2021) , 3/32 GB,
Állásajánlatok
Cég: CAMERA-PRO Hungary Kft
Város: Budapest
Cég: PC Trade Systems Kft.
Város: Szeged