Открытие файла пример кода - язык си

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) ;
}

источник= http://www.roseindia.net/c-tutorials/c-f...

vedro-compota's picture

подразумевается, что файл лежит в той же директории, что и исполняемый файл вашей программы =

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) ;
}

_____________
матфак вгу и остальная классика =)