Redirecting standard output in C

Redirecting standard output in C

CodeVault

4 года назад

89,594 Просмотров

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


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

@hamzabayar3547
@hamzabayar3547 - 14.01.2024 10:32

it was helpful. Thanks a lot

Ответить
@kritonios
@kritonios - 20.10.2023 01:59

Very nice video

Ответить
@abhimanyumithun832
@abhimanyumithun832 - 04.09.2023 09:25

videos are super informative , wannted more video on pipes and dup2 on realtime application .
Thank you for the great explanations

Ответить
@2644374
@2644374 - 11.08.2023 14:57

It was really helpful to understand the basic. Could you please explain How to redirect pipe in and out to standard functions ?

Ответить
@user-lv7ff7rl8y
@user-lv7ff7rl8y - 05.05.2023 16:07

Man, u are cool. Ty very much. My lecturer did not explain the material, but with your help, I learned everything on my own!!

Ответить
@mahirkayadelen9202
@mahirkayadelen9202 - 28.03.2023 13:48

Good explanation thanks

Ответить
@sinistrofu5876
@sinistrofu5876 - 25.03.2023 04:21

bro you're the goat

Ответить
@ashishsarkar5706
@ashishsarkar5706 - 16.03.2023 07:00

Great video . Where can i get the code ?

Ответить
@juggles5474
@juggles5474 - 20.02.2023 00:01

incredible video, thank you!!

Ответить
@LamNguyen-jp5vh
@LamNguyen-jp5vh - 08.02.2023 20:35

Thank you so much for releasing this video! It helped me a lots in OS classes!!!

Ответить
@efmflee
@efmflee - 13.12.2022 19:38

what if we dont close file after dup2(file, stdout_filenon); or it does not matter?

Ответить
@XAyaDubX
@XAyaDubX - 05.12.2022 22:13

This may be the last video I watch of yours at least for a while as my semester is ending and I most likely will never write in C again. I thank you for helping me through my semester. You were a comforting and friendly face through the whole thing. You helped me on a lot of my assignments. You helped me understand programming much better as a whole. I will always be thankful.

Ответить
@user-gn7ho8yu1d
@user-gn7ho8yu1d - 31.10.2022 14:04

i love u

Ответить
@multivalfran
@multivalfran - 30.10.2022 06:52

AMAZING. BEST CHANNEL EVER

Ответить
@t2a392
@t2a392 - 24.10.2022 19:50

Helped me to undestand dup2. Love ur content, hope ur channel will grow bigger, u deserve it.

Ответить
@reverse9822
@reverse9822 - 06.10.2022 05:53

I appreciate your explanation and energy, all my peers watch your videos and helps us finish our projects , thank you so much.

Ответить
@santiagolaseul
@santiagolaseul - 01.10.2022 01:13

you are amazing.

Ответить
@cloudwalker2730
@cloudwalker2730 - 05.08.2022 05:52

In this case what we do in each process is then same, namely, increment the number by 1, so the order the process excecutes doesn't matter. But what if we do different things in process? For example, we want to multiply the number by 2, then add 2, then divide by 4, the order we do this definitely matters to the result, so how do we make sure the processes are excecuted in order? Thank in advance.

Ответить
@lylesnodgrass1961
@lylesnodgrass1961 - 09.07.2022 06:30

These are wonderful presentations. They're relevant, accurate, clear, succinct, and nicely done. Thank you.

Ответить
@hylorial
@hylorial - 21.06.2022 04:28

YOU ARE THE MVP

Ответить
@dtantarjent144
@dtantarjent144 - 04.06.2022 12:09

Perfectly explained, great work!

Ответить
@learnforfree8551
@learnforfree8551 - 22.05.2022 14:53

life saver sir , thank you

Ответить
@erickmedeirosbr
@erickmedeirosbr - 06.05.2022 16:41

Very good

Ответить
@m.preacher2829
@m.preacher2829 - 10.04.2022 19:10

what if we first close the standard output and then create the file. would it also work?

Ответить
@san-wh8dz
@san-wh8dz - 07.04.2022 09:38

You sure hear this alot , but you are really so good ! thx you !

Ответить
@ahmetkemalbayraktar7017
@ahmetkemalbayraktar7017 - 05.04.2022 17:10

thank you very much

Ответить
@alexbianchi72
@alexbianchi72 - 17.03.2022 18:57

This is the most helpful video I have watched in my entire life. I am not even joking. Thank you so much!!

Ответить
@fenix144
@fenix144 - 14.03.2022 04:48

Somehow I cannot get it to work. The open part works fine, the file gets created but nothing gets printed to it. If I find the reason why I'll report back. Edit: I'm fucking stupid I put the file in readonly instead of write only. oops

Ответить
@sylvainducamp8447
@sylvainducamp8447 - 02.03.2022 23:43

I don't understand why you delete the "int file2 = " at the end, can you explain it more ? Great content btw !

Ответить
@darthvader4899
@darthvader4899 - 27.02.2022 05:17

How can i restore STDOUT to File Descriptior 1

Ответить
@darthvader4899
@darthvader4899 - 27.02.2022 05:12

Thank you so much for such a great video. Keep it up and I hope people will realize how fantastic this channel is.

Ответить
@ismail.bentour
@ismail.bentour - 21.02.2022 00:38

very nice

Ответить
@user-si8bk3kz2z
@user-si8bk3kz2z - 09.02.2022 14:52

how can i reproduce behaviour of < {file name} in c? which descriptors i should redirect?

Ответить
@bensmyth450
@bensmyth450 - 06.02.2022 02:41

YOU ARE A SAVIOR

Ответить
@ericscharringa7201
@ericscharringa7201 - 18.01.2022 00:09

Very good video and exactly what I was looking for but still this C++ code doesn't work (date still shows up on screen instead of in file) :

int shell(bool showPrompt) {



pid_t child1 = fork();
if (child1 == 0) {
string naam = "eric.txt";
const char *bestandnaam = naam.c_str();
int bestand = open (bestandnaam, O_CREAT | O_WRONLY, 0777);
if (bestand == -1) cout << "Hier gaat iets mis kind";
int geslaagd = dup2(bestand, STDOUT_FILENO);
if (geslaagd < 0) cout << "Hier gaat iets mis dup2";
Command cmd = {{string("date")}};
executeCommand(cmd); // this performs execvp(cmd)
}
else return 0;
}

Ответить
@naitside3410
@naitside3410 - 15.01.2022 16:08

это интересно. Единственное я не понимаю как работает файловый дескриптор. Я понимаю что два процесса НЕ могут иметь один и тот же файловый дескриптор с номером 3. Но как эта 3 хранит и передаёт открытый файл ? Это очень сложный вопрос, и если переводчик позволит тебе понять суть вопроса и ты ответишь, будет замечательно.

Ответить
@theodeville8222
@theodeville8222 - 28.12.2021 19:48

you are the big boss ty <3

Ответить
@karelcamilomanresa3886
@karelcamilomanresa3886 - 18.12.2021 23:19

Muy buenos videos, me han ayudado mucho 👍

Ответить
@phyroxdimebag3862
@phyroxdimebag3862 - 03.12.2021 07:07

awesome video!

Ответить
@abulkalam7729
@abulkalam7729 - 25.11.2021 23:01

Your content is just amazing, easy to understand.. really helpful, for sure deserve more viewers/subscriber,

Thanks again...really appreciate it..

Ответить
@sm8739
@sm8739 - 22.11.2021 08:45

You channel is 100% underrated, neatly organized and perfectly explained!

Ответить
@shaharrefaelshoshany9442
@shaharrefaelshoshany9442 - 13.11.2021 18:28

this is the best explanation

Ответить
@SonuSharma-ty5vl
@SonuSharma-ty5vl - 07.11.2021 20:43

I'm blown away by this video, thanks for showing these hidden tricks.

Ответить
@stephenradmard9414
@stephenradmard9414 - 11.10.2021 13:17

Hey, thanks for your awesome videos!
QUESTION: How do you go directly into a variable (e.g. char array) directly without opening a FILE?

Ответить
@sethsarchet1020
@sethsarchet1020 - 03.10.2021 22:32

Great video!! This explanation will really help me on a project I'm working on

Ответить
@oliviern.2095
@oliviern.2095 - 24.09.2021 23:01

Great explanation, incredible. Thank you so much.

Ответить
@parisa9374
@parisa9374 - 23.09.2021 02:10

Thank you very much for your great explanation! Just curious what IDE are you using?

Ответить
@taruntomar7795
@taruntomar7795 - 29.08.2021 13:34

That is such a nice explanation i love this guy

Ответить