C writing files✍️

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ต.ค. 2021
  • C write append delete file tutorial example explained
    #C #write #file
    int main()
    {
    // WRITE/APPEND A FILE
    FILE *pF = fopen("C:\\Users\\Cakow\\Desktop\\test.txt", "w");
    fprintf(pF, "Spongebob Squarepants");
    fclose(pF);
    // DELETE A FILE
    /*
    if(remove("test.txt") == 0)
    {
    printf("That file was deleted successfully!");
    }
    else
    {
    printf("That file was NOT deleted!");
    }
    */
    return 0;
    }
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @BroCodez
    @BroCodez  2 ปีที่แล้ว +24

    #include
    int main()
    {
    // WRITE/APPEND A FILE
    FILE *pF = fopen("C:\\Users\\Cakow\\Desktop\\test.txt", "w");
    fprintf(pF, "Spongebob Squarepants");
    fclose(pF);

    // DELETE A FILE
    /*
    if(remove("test.txt") == 0)
    {
    printf("That file was deleted successfully!");
    }
    else
    {
    printf("That file was NOT deleted!");
    }
    */
    return 0;
    }

  • @zizou5638
    @zizou5638 ปีที่แล้ว +14

    The "Nuclear Launch Codes" had me ROFL

  • @stani1k
    @stani1k 2 ปีที่แล้ว +13

    The most important functions explained in a nutshell, thanks!
    Fortunately, I work with C# daily, but it's interesting to see how it all works with the ancestor :D

  • @its.twosday
    @its.twosday 2 หลายเดือนก่อน +1

    thanks for the tips! i got a 91/100 on my midterm from your tutorials :D

  • @s.aravindh6227
    @s.aravindh6227 2 ปีที่แล้ว +1

    Super video bro 👍👍👍👍

  • @BlockierVase3
    @BlockierVase3 8 หลายเดือนก่อน

    Absolute W for wumbo bro, you are the best

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

    You're awesome 🙂

  • @KJ7JHN
    @KJ7JHN 2 ปีที่แล้ว +1

    hey bro do you have a video on accessing perifreal io data? like reading and writing memory addresses for pcie or serial ports? more so pcie addresses. making a pcie spi card.

  • @occqo
    @occqo 2 หลายเดือนก่อน

    tnx ma maaan❤

  • @richardvincentgonzales683
    @richardvincentgonzales683 7 หลายเดือนก่อน +1

    bro just saved my ass

  • @redefined4657
    @redefined4657 7 หลายเดือนก่อน +1

    Became a fellow bro.

  • @denifer_
    @denifer_ 2 หลายเดือนก่อน

    W

  • @ayaanm0min
    @ayaanm0min 2 ปีที่แล้ว +4

    Ur channel is so underated

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

      - Has 700k subscribers

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

      @@lucasc5622 still , in comparison to other channels

    • @icesoul482
      @icesoul482 7 หลายเดือนก่อน

      is 1,38M enough?

  • @Jessica-tz3zl
    @Jessica-tz3zl หลายเดือนก่อน

    Why is it considered to be a good practice to assign NULL if declearing a pointer?

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

    how can we write a PERSISTENT FILE ???? for example if we change something we can use it changed next time we run the program

    • @axelnils
      @axelnils ปีที่แล้ว +7

      Files are persistent, that’s the point of a file.

    • @allmyinterests5139
      @allmyinterests5139 5 หลายเดือนก่อน

      .txt files are persistent

  • @herbert_01
    @herbert_01 6 หลายเดือนก่อน +1

    remove("system.32") ;
    if you want to destroy your computer

  • @calzar6831
    @calzar6831 5 หลายเดือนก่อน

    nah, i'd win

  • @freziyt223
    @freziyt223 2 หลายเดือนก่อน

    how to use abstract file path?

  • @user-ej9pe2fw6x
    @user-ej9pe2fw6x 9 หลายเดือนก่อน +1

    random'

  • @mania-jd3my
    @mania-jd3my 8 หลายเดือนก่อน

    Random

  • @PSIwolf39
    @PSIwolf39 6 หลายเดือนก่อน

    Here' s some code I wrote with this:
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    int main(){
    FILE *pHelloWorld = fopen("c:\\users\\squee\\desktop\\Helloworld.c", "w");
    fprintf(pHelloWorld, "#include

    int main(){
    printf(\"Hello world!\");
    }");
    fclose(pHelloWorld);
    printf("would you like to delete the \"Helloworld.c\" file? (Y|N)
    ");
    char userInput[100];
    fgets(userInput,100,stdin);
    if(userInput[0] == 'Y' || userInput[0] == 'y'){
    if(remove("c:\\users\\squee\\desktop\\Helloworld.c") == 0){
    printf("This file was deleted successfully!");
    }
    else{
    printf("ERROR: file could not be found.");
    }
    }
    else{
    printf("File was not deleted.");
    }
    }

  • @shortsondemanded
    @shortsondemanded 7 หลายเดือนก่อน +2

    bro my file was not deleted ,have a look buddie :
    #include
    int main()
    {
    /*FILE *pF = fopen("test.txt","a");
    fprintf(pF,"
    spongebob squarepants");
    fclose(pF); */
    if(remove("text.txt")== 0)
    {
    printf("file deleted sucessfully");
    }
    else
    {
    printf("file was not deleted");
    }

    return 0;
    }

    • @PSIwolf39
      @PSIwolf39 6 หลายเดือนก่อน +1

      Probably because the file needs to actually exist in order for it to be deleted and the code that creates the file is set as a comment in your code.