strcpy() and strncpy() functions | C Programming Tutorial

strcpy() and strncpy() functions | C Programming Tutorial

Portfolio Courses

2 года назад

36,958 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@ritapiu319
@ritapiu319 - 09.11.2023 13:22

nice, thanks

Ответить
@yamithere_
@yamithere_ - 27.07.2023 12:40

Hii its me again :P
I have a situation where i have to copy the end of the string instead of the first few characters of the string, how can I do it?
Eg. you input into the terminal going './bin/library bin/books.txt' but i just need the 'bin/books.txt' bit to be used inside a fopen() function, and the .txt file could be another file name with longer characters, so how can I make it possible? Thank you!

Ответить
@fifaham
@fifaham - 08.06.2023 15:46

Nice - thank you Kevin.

Ответить
@utwahmwingira8347
@utwahmwingira8347 - 13.02.2023 20:35

What compiler do you use like in general the app you use

Ответить
@thisisreallyme3130
@thisisreallyme3130 - 07.02.2023 22:16

strlcpy()? strcpy_s()?

Ответить
@tostas4452
@tostas4452 - 11.12.2022 01:27

Thankyou so much

Ответить
@abdelmalekelmansouri5844
@abdelmalekelmansouri5844 - 12.11.2022 16:51

thank you so much. please I have a question how we can use all that using the pointers ?

Ответить
@justcurious1940
@justcurious1940 - 29.10.2022 18:18

thanks kevin well explained 🙂

Ответить
@juliaarmstrong7637
@juliaarmstrong7637 - 31.08.2022 17:04

Thank you so much. You are a life saver, man.

Ответить
@liri1189
@liri1189 - 29.08.2022 12:36

Why the code below doesn't produce any error? I use 9 as the size of the destination string even though I have to specify 10 or more (because of the \0 character)

char src[] = "12346789";
char dest1[9];
printf("%s",strcpy(dest1,src));

Ответить
@JV-ro3rb
@JV-ro3rb - 18.08.2022 21:58

Good video, but it doesn't contain enough information to rebuild strncpy(); yourself.

Ответить
@bozomozo1152
@bozomozo1152 - 04.07.2022 00:56

We have to put 10 characters in src[10 ] because we count from 0 so we can put our 10 characters and \0 will put at 10 (11)

Ответить
@marbles5590
@marbles5590 - 26.06.2022 22:41

Hello. I've been using DevC++ and a terminal (in CodeChum), and then when I tried:

char src[10] = "123456789";
char dest2[5];
strcpy (dest2, src);

printf ("%s", dest2);
return 0;

They are still printing the exact 123456789. How could have this happened? Help please.

Ответить
@angelldark6426
@angelldark6426 - 12.06.2022 09:40

Mr.Portfolio Courses. I have 12345678, how a can copy only 3456 ????

Ответить
@JH-it2yr
@JH-it2yr - 24.05.2022 20:10

Perfect! Thank you very much!

Ответить
@pumidol2340
@pumidol2340 - 04.11.2021 21:58

Hi! What’s the editor?

Ответить