Here is the code:

```
  std::ofstream f("file1.txt");
  f<<"123"<<std::endl<<"456";           //(*1)

  /*std::stringstream ordinary_strstream; This works too
  ordinary_strstream<<"123"<<'\n'<<"456";
  f<<ordinary_strstream.str();*/

  std::wstringstream s;
  s<<L"123"<<std::endl<<L"456";         //(*2)
  s<<L"123"<<L"\n"<<L"456";             //(*3) 
  s<<"123"<<WCHAR(13)<<WCHAR(10)<<"456";//(*4)

  HANDLE h =CreateFileW(L"file2.txt", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
    NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

  ULONG l;
  WriteFile(h, s.str().c_str(), s.str().length() * 2, &l, NULL);

```

In the (\*1) case there is a newline, in the (\*2) and (\*3) i see no newline in the file2.txt. In the (\*3) there is a newline. I use `notepad.exe` for browsing. Hex editor shows no `0x0D` byte, only `0x0A`.

How should i properly put the newline in unicode text file? Thank you.