remove() function for deleting files | C Programming Tutorial

Поделиться
HTML-код
  • Опубликовано: 2 фев 2025

Комментарии • 11

  • @yusufkaramoglu6155
    @yusufkaramoglu6155 2 года назад

    hello, i have a fileon windows 10 and the code gives me error 13 - permission denied, any ideas how i can fix that ?

    • @PortfolioCourses
      @PortfolioCourses  2 года назад

      Great question Yusuf! :-) I would suggest checking the file permissions. For example if the file is read-only, then we won't be able to remove the file.

    • @anneforger1279
      @anneforger1279 6 месяцев назад

      it may sound really really silly, but at first you need to fclose() the file before deleting it. i spent an hour trying to find out why it wasnt working :c

  • @vicsteiner
    @vicsteiner 7 месяцев назад +1

    Running it on Ubuntu and compiling with gcc In did not have to include stdlib.h. If I check man remove I see it is in stdio.h. So I do not have it clear in which situations we need to actually include stdlib.h? Or maybe this is just a system specificity?

  • @montyGator
    @montyGator Год назад

    So, would this function only delete files that are in the same folder as the code, or can it delete ANY file on your computer?

    • @PortfolioCourses
      @PortfolioCourses  Год назад +1

      You should be able to use it to delete files in other directories, like the example here: pubs.opengroup.org/onlinepubs/007904975/functions/remove.html. Technically it will delete the file in the "current working directory" which should be the directory you run the compiled program in.

    • @montyGator
      @montyGator Год назад

      @@PortfolioCourses Great! Thank you!

    • @PortfolioCourses
      @PortfolioCourses  Год назад +1

      You're welcome! :-)

  • @mongraal2272
    @mongraal2272 2 года назад +1

    Thank you!

  • @cristhianjardim2577
    @cristhianjardim2577 2 года назад

    A great voice, holy