Log in

View Full Version : The mystery of the lost line-break


LoRd_MuldeR
2nd June 2016, 19:04
Okay, so I'm running this, expecting that the dir command would pass all file names in the current directory to my program stdindmp, one per line:

chcp 65001
dir /b | stdindmp.exe

My program simply reads all lines from the STDIN, using fgetws(), and then writes them back to STDERR. So, the expected output would be that my program writes all file names to the console, one per line.

This does work, most of the times. However, every now and then, some line breaks disappear miraculously, resulting in wrong output! :eek: :scared:

[...]
``Doom3_294.jpg创
``Doom3_295.jpg创
``Doom3_296.jpgDoom3_297.jpg创
File ``E:\PiCz\sCrEeNsHoTz\Doom3_296.jpgDoom3_297.jpg创 not found!
``Doom3_298.jpg创
``Doom3_299.jpg创
``Doom3_300.jpg创
[...]

Any idea what the heck is going on here? :confused:

(code attached)

LoRd_MuldeR
2nd June 2016, 20:34
So, I re-built the exactly same code with VS2010, just to be sure. Problem gone!

Original build was VS2015. So, bug in VS2015 or what ???

:rolleyes: :mad:

LoRd_MuldeR
2nd June 2016, 22:07
So, I re-built the exactly same code with VS2010, just to be sure. Problem gone!

Original build was VS2015. So, bug in VS2015 or what ???

:rolleyes: :mad:

Looks like a regression in the new "Universal CRT" introduced with VS2015:
https://connect.microsoft.com/VisualStudio/Feedback/Details/1902345

(Fix scheduled for Windows 10 Anniversary Update, it appears)