C writing files✍️

preview_player
Показать описание
C write append delete file tutorial example explained

#C #write #file

int main()
{
// WRITE/APPEND A FILE

fprintf(pF, "Spongebob Squarepants");

fclose(pF);

// DELETE A FILE
/*
{
printf("That file was deleted successfully!");
}
else
{
printf("That file was NOT deleted!");
}
*/
return 0;
}
Рекомендации по теме
Комментарии
Автор

#include <stdio.h>

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;
}

BroCodez
Автор

The "Nuclear Launch Codes" had me ROFL

zizou
Автор

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

its.twosday
Автор

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

stanik
Автор

Absolute W for wumbo bro, you are the best

BlockierVase
Автор

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.

KJJHN
Автор

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

Jessica-tzzl
Автор

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

IliasPapastamatis
Автор

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

herbert_
Автор

Here' s some code I wrote with this:

#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <stdlib.h>
#include <time.h>

int main(){
FILE *pHelloWorld = fopen("c:\\users\\squee\\desktop\\Helloworld.c", "w");
fprintf(pHelloWorld, "#include <stdio.h>\n\nint main(){\nprintf(\"Hello world!\");\n}");
fclose(pHelloWorld);
printf("would you like to delete the \"Helloworld.c\" file? (Y|N)\n");
char userInput[100];
fgets(userInput, 100, stdin);
if(userInput[0] == 'Y' || userInput[0] == 'y'){
== 0){
printf("This file was deleted successfully!");
}
else{
printf("ERROR: file could not be found.");
}
}
else{
printf("File was not deleted.");
}
}

PSIwolf
Автор

bro my file was not deleted, have a look buddie :

#include <stdio.h>

int main()
{
/*FILE *pF = fopen("test.txt", "a");


fprintf(pF, "\nspongebob squarepants");


fclose(pF); */




if(remove("text.txt")== 0)
{
printf("file deleted sucessfully");
}
else
{
printf("file was not deleted");
}

return 0;
}

shortsondemanded