i guys,
I'm seeing that fprintf or fflush not throw a error when a UNC path( \\computer-name\shared\logs\seq.txt ) is inactive.
I started my app and i'm unplugging network cable.
fprintf or fflush not return error when UNC path is inactive.
Somebody knows something about this?
// app sample
std::string m_seqNumsFileName("\\\\comp-1\\storage\\logs\\seq.txt");
FILE* m_seqNumsFile = NULL;
errno_t i = 0;
i = fopen_s( &m_seqNumsFile, m_seqNumsFileName.c_str(), "r+" );
if ( !m_seqNumsFile ) i = fopen_s( &m_seqNumsFile, m_seqNumsFileName.c_str(), "w+" );
int iSender = 0, iTarget = 0;
for( int a = 0; a < 100; a++ )
{
rewind( m_seqNumsFile );
fprintf( m_seqNumsFile, "%10.10d : %10.10d",
iSender++, iTarget++ );
if( iSender > 10 ) // Unplugging network cable
if ( ferror( m_seqNumsFile ) )
throw std::exception( "Unable to write to file " );
if ( fflush( m_seqNumsFile ) )
throw std::exception( "Unable to flush file " );
}