Открытие файла пример кода - язык си
Primary tabs
Forums:
#include stdio.h>
#include conio.h>
void main() {
FILE *fp;
fp = fopen("MYFILE.txt", "a");
fprintf(fp, "%s\n ", "Hello World, Where there is will, there is a way."); // запишем в файл такую строчку
fclose(fp) ;
}
- Log in to post comments
- 5186 reads
vedro-compota
Thu, 10/27/2011 - 17:35
Permalink
или например так
подразумевается, что файл лежит в той же директории, что и исполняемый файл вашей программы =
int openfileforme (void) { FILE *fp; char file1n[80]; printf("[%s]\n", "...open file for me now..."); if (fp=fopen("123.txt", "a")) { printf("[%s]\n", "file is open"); return TRUE; } else { printf("%s\n", "(!) Error = File openning was failed. "); return FALSE; } fprintf(fp, "%s\n ", "Hello World, Where there is will, there is a way."); fclose(fp) ; }_____________
матфак вгу и остальная классика =)