#include <stdio.h>
int main()
{
FILE *f;
char buff[255];
// Burda yazma modunda dosyamızı açıyoruz bunu "wb" olarak "Write Binary" olarakda acabilirdik veya "a+" bu modda ise kaldığımız yerden devam edebiliriz. echo "merhaba" >> /temp/test.txt gibi
f = fopen("/temp/test.txt","w");
fputs("Test say hello", f);
// burda dosyası mutlaka kapamalıyız eğer biz yapmazsak return fonksiyonu veya main son parantezi "}" bu alanı işletim sistemine geri tahsis edecektir.
fclose(f);
// Read yani okuma modunda açıyoruz dosyamızı yazma işlemi yapamayız sadece okuyacağımızı belirttik
f = fopen("/tmp/test.txt", "r");
// f dosyamızdan 255 karekter buff char değişkenimeze okuma yapıyoruz.
fgets(buff, 255, (FILE*)f);
fclose(f);
}
Categories: C language
9 Comments
นักสืบ · 21/01/2025 at 03:34
… [Trackback]
[…] Find More to that Topic: durukanbal.com/2021/01/17/c-write-read-file-sample/ […]
som777 · 25/01/2025 at 12:57
… [Trackback]
[…] Read More on that Topic: durukanbal.com/2021/01/17/c-write-read-file-sample/ […]
hit789 · 25/01/2025 at 16:53
… [Trackback]
[…] Info to that Topic: durukanbal.com/2021/01/17/c-write-read-file-sample/ […]
โอลี่แฟน · 04/03/2025 at 05:25
… [Trackback]
[…] Find More on that Topic: durukanbal.com/2021/01/17/c-write-read-file-sample/ […]
lg96 · 05/03/2025 at 13:50
… [Trackback]
[…] Here you can find 13470 more Information on that Topic: durukanbal.com/2021/01/17/c-write-read-file-sample/ […]
จองตั๋วรถทัวร์ออนไลน์ · 06/03/2025 at 02:06
… [Trackback]
[…] Find More here on that Topic: durukanbal.com/2021/01/17/c-write-read-file-sample/ […]
Diaphragm Husky · 07/03/2025 at 02:59
… [Trackback]
[…] Information on that Topic: durukanbal.com/2021/01/17/c-write-read-file-sample/ […]
Cloud Storage · 12/03/2025 at 03:23
… [Trackback]
[…] Read More Information here to that Topic: durukanbal.com/2021/01/17/c-write-read-file-sample/ […]
bgame777 · 13/03/2025 at 06:48
… [Trackback]
[…] Read More to that Topic: durukanbal.com/2021/01/17/c-write-read-file-sample/ […]