Download "C writing files✍️"

Download this video with UDL Client
  • Video mp4 HD+ with sound
  • Mp3 in the best quality
  • Any size files
Video tags
|

Video tags

language
for
beginners
youtube
lesson
tutorial
lectures
arrays
functions
pointers
structures
how
to
learn
education
class
C (Programming Language)
C File Input/output
Writing (Interest)
c
write
file
Subtitles
|

Subtitles

00:00:02
all right let's do this here's how we
00:00:04
can write to a file in c let's create a
00:00:07
file pointer the data type is file and
00:00:10
i'll name this pf it's a pointer to a
00:00:13
file and i will set this equal to then
00:00:16
invoke the f open function we will pass
00:00:19
in a name we would like to give our file
00:00:22
let's name this test.txt
00:00:24
but if you would like this to be a
00:00:26
different file extension such as html
00:00:28
well you can change it to that then uh
00:00:30
we'll keep this as a plain text file
00:00:32
just to keep it simple and to write to a
00:00:35
file there is a second argument a mode
00:00:38
so this could be w for right a for
00:00:41
append r for read but we are looking for
00:00:44
w for now so it is good practice at the
00:00:47
end of your program to close any files
00:00:49
that are open so we will use the f close
00:00:53
function and pass in our pointer p f
00:00:57
make sure to not dereference it now to
00:00:59
write a line of text to our file we can
00:01:01
use f print f
00:01:04
pass in our pointer p f do not
00:01:07
dereference it and then some string of
00:01:09
text let's say spongebob squarepants
00:01:13
so this file will be created in the same
00:01:16
folder as my c program so after running
00:01:19
this
00:01:20
we have a new text file within the same
00:01:22
folder and it says spongebob squarepants
00:01:26
what if i run this again and write
00:01:27
something different like patrick
00:01:30
starr
00:01:32
so if the mode is w
00:01:34
then we will actually overwrite any
00:01:36
existing data already within this file
00:01:39
if we need to append a file we can use
00:01:42
the a mode for append so this time let's
00:01:45
append some text to the end of our
00:01:46
document
00:01:49
spongebob squarepants
00:01:52
and you'll have to keep track of any new
00:01:54
lines that you add too so if i run this
00:01:56
again and this time i am appending some
00:01:58
text
00:02:01
well patrick star is still there and we
00:02:03
appended spongebob squarepants to the
00:02:05
end of our file
00:02:07
now if you would like to delete a file
00:02:09
here's how i'm going to turn all of this
00:02:11
into one giant comment
00:02:14
let's use a little bit of file detection
00:02:16
let's check to see if our file does
00:02:18
exist
00:02:20
within our if statement let's invoke the
00:02:22
remove method and we will pass in the
00:02:25
name or location to our file
00:02:28
test.txt if we remove this file
00:02:30
successfully it will return zero so if
00:02:34
after invoking the remove function if
00:02:36
this returns zero that's its exit code
00:02:39
that means that file was deleted
00:02:41
successfully let's print a message to
00:02:43
let the user know
00:02:45
that
00:02:46
file
00:02:47
was deleted
00:02:50
successfully
00:02:52
else we will print a different message
00:02:54
printf
00:02:57
that file was not
00:02:59
deleted
00:03:00
okay let's try this so here's my file
00:03:03
within the same folder if i run this
00:03:06
that file was deleted successfully and
00:03:09
that file is no longer within the same
00:03:11
folder you can see here that this says
00:03:13
deleted
00:03:14
and if i run this again we will not be
00:03:15
able to locate that file because it's
00:03:17
not there
00:03:18
now you can write a file to a different
00:03:20
location let's say i would like to write
00:03:23
a file to my desktop i can set a
00:03:25
relative file path or an absolute file
00:03:28
path i'll use an absolute file path
00:03:31
i'm going to get the file location of my
00:03:33
desktop so i'm just going to click on
00:03:35
one of these folders
00:03:37
go to properties
00:03:39
and copy this location
00:03:42
so with my file name i'm going to
00:03:44
precede this with an absolute file path
00:03:47
then any backslashes might need to be
00:03:50
double backslashes
00:03:51
so this time if i write a file
00:03:54
then this file will appear at this
00:03:56
location on my desktop
00:03:58
and here's that file
00:04:00
test.txt and it says spongebob
00:04:03
squarepants
00:04:04
well alright everybody that is how to
00:04:06
write append and delete files in c if
00:04:09
you found this video helpful be sure to
00:04:11
help me out by smashing that like button
00:04:14
leave a random comment down below and
00:04:16
subscribe if you'd like to become a
00:04:17
fellow bro

Description:

C write append delete file tutorial example explained 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; }

Mediafile available in formats

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

question iconHow can I download "C writing files✍️" video?arrow icon

    http://univideos.ru/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

    The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

    UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

    UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

question iconWhich format of "C writing files✍️" video should I choose?arrow icon

    The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

question iconWhy does my computer freeze when loading a "C writing files✍️" video?arrow icon

    The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

question iconHow can I download "C writing files✍️" video to my phone?arrow icon

    You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

question iconHow can I download an audio track (music) to MP3 "C writing files✍️"?arrow icon

    The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

question iconHow can I save a frame from a video "C writing files✍️"?arrow icon

    This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

question iconHow do I play and download streaming video?arrow icon

    For this purpose you need VLC-player, which can be downloaded for free from the official website https://www.videolan.org/vlc/.

    How to play streaming video through VLC player:

    • in video formats, hover your mouse over "Streaming Video**";
    • right-click on "Copy link";
    • open VLC-player;
    • select Media - Open Network Stream - Network in the menu;
    • paste the copied link into the input field;
    • click "Play".

    To download streaming video via VLC player, you need to convert it:

    • copy the video address (URL);
    • select "Open Network Stream" in the "Media" item of VLC player and paste the link to the video into the input field;
    • click on the arrow on the "Play" button and select "Convert" in the list;
    • select "Video - H.264 + MP3 (MP4)" in the "Profile" line;
    • click the "Browse" button to select a folder to save the converted video and click the "Start" button;
    • conversion speed depends on the resolution and duration of the video.

    Warning: this download method no longer works with most YouTube videos.

question iconWhat's the price of all this stuff?arrow icon

    It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.