How to use Pipes in C and Linux

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 พ.ย. 2024

ความคิดเห็น • 7

  • @jagadeeshanms2863
    @jagadeeshanms2863 3 ปีที่แล้ว +1

    your videos are great, i am watching all your videos♡

  • @NOPerative
    @NOPerative ปีที่แล้ว

    Awesome fella!

  • @wshorrock
    @wshorrock 3 ปีที่แล้ว +2

    Great Video

  • @weeb3277
    @weeb3277 3 ปีที่แล้ว +3

    Do you ever plan to do a video dedicated to stdin, stdout and stderr?
    You did mention them in your "How to create your own linux command?" video.
    But it was kinda brief and would be nice to see how errors fire from within a language.
    Plus it's easier to share a stand alone video, no need to timestamp.

    • @GreggInkCodes
      @GreggInkCodes  3 ปีที่แล้ว +3

      The problem is: I don't think there is enough to say for an entire video. When you start a program, 3 file descriptors are automatically available as provided by the kernel. File descriptors are defined by a number, thus you have 0 (stdin), 1 (stdout) and 2 (stderr). If you decide to open a file on your drive, the file descriptor for that file will be the next number, i.e. 3. Those file descriptors can be accessed with syscalls read() and write() or with glibc wrappers like fread, fwrite, fprintf, etc.
      Macros are defined in stdio.h (or a file it includes) because humans prefer typing 'stdin' rather than the number 0.
      I am not sure what you mean with an error 'firing within a language'. The C language is not responsible for errors produced at run-time and errors at compile time are generated by the compiler. If you do get an error in your code at run time, there is a high chance it was produced inside glibc by writing to stderr. You can generate your own errors within your code by writing fprintf( stderr, "Here is some error.");
      I hope that clarifies things enough for you. Let me know if there is anything else.