Prueba esto, yo lo he probado y funciona
   
   char buffer [10];
   buffer[0]='1';
   buffer[1]='\r';
   buffer[2]='\n';
   buffer[3]='2';
   buffer[4]=0;
   CFile f("C:\\Pepe.txt",CFile::modeCreate);
   f.Close();
   CFile f2("C:\\Pepe.txt",CFile::modeWrite);
   f2.Write(buffer,strlen(buffer));
   f2.Close();