CString str; str.Format("heljrasjfdlsfsdljf"); FILE *fp; fp = fopen("D:\\1.txt","a+"); fprintf(fp,"%s",str); fclose(fp);