Hi,
In my C++ application, wherein, I am trying to allocate Buffer and Read the buffer allocated, and ensure Read SCSI() returns successfully(Good Status)
my Steps. 1. Write Some buffer check write buffer successfull assume 512 bytes
2. Read the same buffer written ensure ReadSCSI is successfull.
3. Ultimately ensure Write buffer and Read buffer comparison is identical,
I need a snippet of code(directly compares Write Buffer/Read Buffer without convolutions) where in
Compare(Read/Write)buffer is same, if not otherwise throw an exception?
I am using VS2008 IDE, VC++ environment.(Windows 7 o/s).
With Regards,
Vishalk_90
<pre lang="c++">SaveToLog(LOG_POS1, Write(write_Buffer,lba,num_of_sect,0,0);
if((ec = ProjCmd.Write(lba,write_buffer,1,0,0) != EC_NOERROR)
{
SaveToLog(LOG_ERR1, "Write Wrapper failed. Unexpected ec: 0x%x", ec);
return false;
}
SAVEToLog(LOG_STEP, "Verify if Write Command Successfully Completed");
ProjCmd.Sensekey(EC_NOERROR, "Write Command did not return Good Status");
SaveToLog(LOG_MSG1, "Write command erturned Good Status");
SaveToLog(LOG_STEP2, "Issue Read Command by giving the input parameters");
if((ec= ProjCmd.Read(lba,Read_buffer,num_of_sect,0,0) != EC_NOERROR)
{
SaveToLog(LOG_ERR, "Read Wrapper failed, Unexpected ec: 0x%x",ec);
return false;
}
ProjCmd.parser.AssertSenseKey(EC_NOERROR, "Read Command did not return Good Status");
SaveToLog(LOG_STEP,"Verify if Read returned correct amount of data");
ProjCmd.parser.GetReturnLength(dataTransLen);
if(dataTransLen != 512)
{
SaveToLog(LOG_ERR, "Read Command did not transfer the correct amount of data");
return false;
}
SaveToLog(LOG_MSG, "Read Buffer & Write Buffer is same");
return true;