C/Czytanie i pisanie do plików: Różnice pomiędzy wersjami
Usunięta treść Dodana treść
→Pliki a strumienie: literówka |
→Obsługa błędów: inny sposób |
||
Linia 88:
dostaniemy komunikat:
błąd otwarcia pliku: No such file or directory
Inny sposób :<ref>[http://stackoverflow.com/questions/8633909/what-is-the-reason-for-fopens-failure-to-open-a-file StackOverflow : what is the reason for fopen's failure to open a file
]</ref>
<source lang=c>
#include<stdio.h>
#include <errno.h>
int main()
{
errno = 0;
FILE *fb = fopen("/home/jeegar/filename","r");
if(fb==NULL)
printf("its null");
else
printf("working");
printf("Error %d \n", errno);
}
</source>
===Zaawansowane operacje===
|