How to simulate a file read error in the CRT

Posted by Mark0978 on Stack Overflow See other posts from Stack Overflow or by Mark0978
Published on 2010-05-24T15:03:52Z Indexed on 2010/05/24 15:11 UTC
Read the original article Hit count: 335

Using VS2008, we would like to simulate a file that has a size of X, but that has a read failure at X-Y bytes, so that we get an error indication.

Anyone have an idea of how to do this on windows? Looks like there is a solution for linux, but I can't really come up with a way to do this on windows. We have multiple developers, multiple machines, and cppunit testing framework, so I want a software only design.

I'm trying to simulate the actual CRT failing, so I can test the code that is dealing with the failure.

© Stack Overflow or respective owner

Related posts about c++

Related posts about Windows