title: How to writefile in new line in WIN32 API
body: <p>I'm trying to write data to file. However, I want to add new data in new line, but now I can't.</p>
  
  <pre><code>HANDLE hFile;
  hFile = CreateFile(_T("HELLO.txt"),               // file to open
      GENERIC_WRITE,          // open for writing
                     0,       // share for writing
                     NULL,                  // default security
                   //  CREATE_NEW,         // existing file only
                   OPEN_ALWAYS,
                     FILE_ATTRIBUTE_NORMAL, // normal file
                     NULL);                 // no attr. template
  
  // Write to File
  BOOL bErrorFlag = FALSE;
  
  DWORD dwPtr = SetFilePointer( hFile, 0, NULL, FILE_END); //set pointer position to end file
  LPWSTR data = _T("Data '\n'");
  DWORD dwBytesToWrite = lstrlenW(data)*2;
  DWORD a = 0;
  bErrorFlag = WriteFile( 
                  hFile,           // open file handle
                  data,      // start of data to write
                  dwBytesToWrite,  // number of bytes to write
                  &amp;dwPtr, // number of bytes that were written
                  NULL);            // no overlapped structure
  </code></pre>