dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersSriram
Phagu Mahato
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » .NET »

Attempted to read or write protected memory


Posted Date: 21 May 2012      Posted By:: Chinna     Member Level: Bronze    Member Rank: 0     Points: 5   Responses: 0



I am getting the the exception "Attempted to read or write protected memory.This is often an indication that other memory is corrupt" because of below code. Could you please help in the below code?

private void Configure()
{
try
{
string filePath = string.Empty;
FileStream fsRead;
BinaryReader binRead;
int rtnVal = 0;

filePath = GetBaseDirectory(@"\") + "Sample.BIN";
if (File.Exists(filePath) == false) return;

fsRead = new FileStream(@filePath, FileMode.Open);
binRead = new BinaryReader(fsRead);
if (binRead != null && binRead.BaseStream.Length > 0)
{
int MsI = -1;
binRead.BaseStream.Seek(0, SeekOrigin.Begin);
CRsiFkeyData pFkeyData = new CRsiFkeyData();
byte[] byteArray = binRead.ReadBytes(Convert.ToInt32(binRead.BaseStream.Length.ToString()));

while (++MsI < binRead.BaseStream.Length)
{

unsafe
{
pFkeyData.data[MsI] = byteArray[MsI];
}
}

rtnVal = objRsiHandReader.CmdPutFkeyData(pFkeyData);
binRead.Close();
}
fsRead.Close();
}
catch (Exception Ex)
{
Global.MakeEntry(Ex.Message + " Configure");
}
}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Post Reply
You must Sign In to post a response.

Next : How to get the data of datagrid view into rich textbox.
Previous : How to download and instaal .net to learn c#.net and vb.net ?
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.