ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก
ต่อไป
เล่นอัตโนมัติ
Reading from text files in CCodeVault
มุมมอง 28K
File Access Basics | C Programming TutorialPortfolio Courses
มุมมอง 89K
why do header files even exist?Low Level Learning
มุมมอง 384K
มายคราฟแต่ถ้าผม "ต่อยอะไร" ผมจะ "แปลงร่าง" เป็นสิ่งนั้น!?Zalmonz
มุมมอง 107K
لااا! هذه البرتقالة مزعجة جدًا #قصيرOne More Arabic
มุมมอง 20M
"โค้ชเป้" โค้ชที่เป็นมากกว่าโค้ชStadium TH
มุมมอง 77K
เพื่อนคนนี้เดาใจยากจัง 🤨 | Garena Free FireGarena Free Fire TH
มุมมอง 200K
Reading/Writing structs to files (aka Serialization)CodeVault
มุมมอง 74K
Binary data exercise: how to tell if a file is a jpeg?Jacob Sorber
มุมมอง 13K
System Programming with C - Opening and Reading FilesOliveStem
มุมมอง 3.4K
Reading and Writing from Binary Files in C!Astrocode
มุมมอง 10K
Format and parse datetime in CCodeVault
มุมมอง 3.8K
The write system call function in COceano
มุมมอง 26K
Binary File Access Introduction | C Programming ExamplePortfolio Courses
มุมมอง 25K
Master Pointers in C: 10X Your C Coding!Dave's Garage
มุมมอง 294K
Scanf Basics: the good, the bad, and why so many pointers?Jacob Sorber
มุมมอง 22K
บุษบา - โย นาคราชคู่【COVER VERSION】 Original - เมนทอลนาคราชคู่ เอนเตอร์เทนเมนท์
มุมมอง 100K
【พากย์ไทย】EP01 แต่งงานก่อน ตกหลุมรักทีหลัง | เด็กสาวแกล้งทำเป็นพี่ของเธอไปแต่งงานกับซีอีโอFresh Thailand Pro
มุมมอง 75K
I Just Wanted to Build a House! 😭ToolTastic
มุมมอง 7M
เหยียบเศษแก้วบนชายหาด ดีนะที่ใส่รองเท้า!! Be careful glass shards on the beach #ขยะ #savetheworldคิดดีทีวี | Kiddee TV
มุมมอง 434K
Ở đây chúng tôi tôi không ăn khoai tây như vậy || Naughty Angel Eating French Fries #shortsBon Bon Media
มุมมอง 3.7M
‘อิหร่าน‘ จัดชุดใหญ่ถล่ม ‘อิสราเอล’ สงครามโลกครั้งใหม่มาแน่! | DEEP Talkกรุงเทพธุรกิจ
มุมมอง 342K
Blindfolded guessing Feastables chocolate @MrBeast @MrBeast2 #feastables #chucky #chocolateSpriteDer SPD
มุมมอง 1.6M
You have one of best C programming tutorials on youtube. Your channel is a precious gem. Thank you for all your hard work.
Clear and objective explanation... I'm in love with yours videos, sir
Nice informative video, keep up the good work!
thanks for the video man!
hi , just a quick note that when you clarify the struct type again at the end the clarification at the beginning is optional,
so you can write it like:
typedef struct{
}point;
You can use,
# pragma warning(disable:4996)
at the start of your file it disables warnings related to _s or secure functions in Newer versions of Visual Studio.
Nice! Thanks for the tip. Nowadays I use the macro _CRT_SECURE_NO_WARNINGS to remove those pesky warnings. Very strange for them to actually be in the standard while only MSVC implementing them :/
You are very impressive with your videos..
thank you so much, really
Where can I learn more about why FILE is used, or the difference between any of these functions and their differences between them and their _s counterparts, or why a buffer is needed.
FILE is just the type that is used for file handles in the C standard library. I will make a video explaining the _s functions in more detail
Question, should you write strlen(buffer_out) + 1 to include \0 in general or does it not matter?
No. The \0 (aka the NULL terminator) is a C-specific standard for strings and some editors wouldn't know how to handle that NULL terminator.
@@CodeVault I see, thank you
hi, im new to reading and writing files, may i know why you declared two char strings buffer_in and buffer_out and only used buffer_out ?
I use the buffer in the next video regarding reading from files
Hi. fopen and sprintf have different parameters now (2 in fopen and 2 + n for sprintf). Did that change over the course or am I missing something?
If you are using the _s versions, they take more parameters
Thank's for these videos, how can i set the txt file in utf8 for characters like "ñ"
I haven't worked with those characters in C but, I think, a good starting point is to take a look at the wchar functions that C has to offer: en.wikibooks.org/wiki/C_Programming/wchar.h
www.cplusplus.com/reference/cwchar/
I get a warning "passing argument # of 'sprintf' makes pointer from integer without a cast".
Oh! If you're using sprintf (without the _s) then you don't need to pass the 256 integer as the second argument
Is there a way to get ready/write capabilities on the same file at the same time? Is that best practice?
Yes, you can call fopen with the r+ tag for both reading and writing to the file. Just be careful where the file cursor is. Here's more documentation: cplusplus.com/reference/cstdio/fopen/
fprintf is also a convenient function to use, right?
Yep, fprintf can also be used
Sal,tu esti din romania?
Da
what is difference between fpritnf and sprintf ?
fprintf takes in a stream as its first parameter (so either a file or stdout/stderr), so it writes to those
sprintf takes in a pointer to char as its first parameter and writes the data to that string
Are u portugues?
No, I'm Romanian
this work with me
i don't have fopen_s
#include
#include
typedef struct Point {
int x, y;
} Point;
int main(int argc, char* argv[]){
Point p1 = {
.x = 12,
.y = -9
};
FILE* in;
FILE* out;
char buffer_in[256], buffer_out[256];
out = fopen("point.dat" , "w");
sprintf(buffer_out, " %d , %d
" , p1.x , p1.y);
fwrite(buffer_out, sizeof(char), strlen(buffer_out), out);
return 0;
}
That's okay. fopen_s (or any _s functions) are available only if you're using the VisualC compiler on Windows