C++ :: NorFlash Memory Access - Read / Write And Erase Data

Sep 5, 2013

I am doing a project which I have to read, write and erase data from a NorFlash Memory. Then, I have to compare those data files in order to find errors.

Besides, I would like to know which is the best way to TEST errors in this kind of memories.

I am using NetBeans 7.3.1 for writting the code and Cygwin running on Windows XP Virtual Machine. The Memory Flash (S29JL064J 64 Megabit) is incorporated on an external board which is connected to an adapter board (using HDMI cable). This adapter is connected to the Laptop (using an USB).

View 3 Replies


ADVERTISEMENT

Visual C++ :: System Access Violation Exception / Attempted To Read Or Write Protected Memory

Mar 17, 2013

I have CAN Dll program for my application,which was separately used.Now I have included the Drivers program into my application Program and I am having this error System Access Violation Exception:Attempted to read or write protected memory.i am attaching the Dll code and Application code which is throwing this error.

[CODE]

The CAN Dll Code

int receive_data(unsigned char *data_output, int *MsgId, XLportHandle g_xlPortHandle){
XLstatusxlStatus, xlStatus_new;
XLevent xlEvent;
unsigned intmsgsrx=RECEIVE_EVENT_SIZE;
char *local_data ="11111111";
DWORD status;
xlStatus_new = xlSetNotification(g_xlPortHandle, &h, 1);

[code]...

My Application Code which is the receiver thread for accessing the messages got onto the CAN bus.

DWORD WINAPI Rcv_Msg(LPVOID param){
int*MsgId = new int;//msg id from CAN
intRcvVal;//0 = there is data in the queue; 1 = there is no data
unsigned int uMsgId;
*MsgId = 0;
unsigned char CanData[8];

[code]...

View 1 Replies View Related

C/C++ :: BST - Cannot Access Memory Data

Nov 11, 2014

When I return mem add I cannot access the data in that add: in bin search tree

Curr=findMin(root);
cout<<"val: "<<Curr->barcode<<endl;
bst::hwareItem* bst:: findMin(hwareItem*& root){

while(root!=NULL){
root=root->left;
}
return root;
}

View 1 Replies View Related

C :: Read And Write Datatypes To Memory Array

Oct 5, 2014

I'm not sure if I should do this with malloc or a char array. What I need to do is create 4 methods to read and 4 to write to memory like this (and it has to be fast):

Code:

char GetByte(char* memory, int offset);
uint16 GetInt16(char* memory, int offset);
uint32 GetInt32(char* memory, int offset);
char[] GetString(char* memory, int offset);

So basically memory is the malloced memory and the offset is the position I want to read at.

I'm not sure if there's already a way to do this and maybe I'm overlooking something.

View 4 Replies View Related

C/C++ :: Read And Write Datatypes To Memory Array

Oct 5, 2014

I decided I wanted to make a proper programming language with a virtual machine and bytecode. I used this tutorial: [URL] .....

As a starting point for my project. So far I have modified it to allow for 32-bit addressing so that I can theoretically use 4GB in my programs. Now the problem I'm having is creating the memory.

Question:

I'm not sure if I should do this with malloc or a char array. What I need to do is create 4 methods to read and 4 to write to memory like this (and it has to be fast):

char GetByte(char* memory, int offset);
uint16 GetInt16(char* memory, int offset);
uint32 GetInt32(char* memory, int offset);
char[] GetString(char* memory, int offset);

So basically memory is the malloced memory and the offset is the position I want to read at.

View 8 Replies View Related

C Sharp :: Access Denied For Windows Service To Read Or Write Files

Aug 22, 2012

Windows service not able read file from network even after giving UNC path whereas works fine when given local directories ....

View 1 Replies View Related

C# :: Combobox And Button - Attempted To Read Or Write Protected Memory

Mar 30, 2014

I have two from in visual studio 2010 with C#. In form1 I have one combobox and one button .In form2 I have Reportviewer . When Button in form1 is clicked form2 is shown. Now my problem is when I click button to show form2 on the line Form2.Show(); this error appear : Attempted to read or write protected memory. This is often an indication that other memory is corrupt. What can i do? In form1 I have one combobox that combo fill with Database with this code in the Form Load:

private void DocReportOnlyAlalhesabSearch_Load(object sender, EventArgs e) {
//fill shahrestan Combo
if (Class.Global.CurrentYear.Length != 0) {
OleDbConnection conn1;
OleDbCommand cmd1;
cmd1 = new OleDbCommand();

[Code] ....

View 5 Replies View Related

C++ :: Access Violation When Using Pointers To Read Data

Apr 23, 2013

I have the following method to read in a data file using a struct and a doubly linked list.

The readFile method is as follows:

Code:
struct contact *readFile(char * FName,struct contact **ptrList) {
struct contact *head, *newContact;
FILE *fptr;
char oneLine[60];
char *sname, *fname, *phone,*company, *email;

[Code] .....

My struct definition is like this:

Code:
struct contact {
char sname[15];
char fname[15];
char phone[15];
char company[15];
char email[15];
struct contact *prev;
struct contact *next;
};

View 2 Replies View Related

C :: Data Read And Write

Dec 22, 2013

My program needs to receive data continuously from one process and the received data is read continuously by another process.But when I am trying to create a pipe using mknod on fat32 file system in linux , it throws an error saying "mknod: operation not permitted".

View 3 Replies View Related

C++ :: Data Structures - File Size Not Decreasing When Erase A Record

Nov 26, 2014

// my size is not decreasing when I erase a record.
//dvr_hwch.cpp

#include <iostream>
#include <iomanip>
#include <cassert>
using namespace std;
#include "hash_chn.h"
void print_menu( );

[Code] .....

View 1 Replies View Related

C++ :: Access Private Data Of Base Class Without Access Modifier

Sep 9, 2013

if we don't provide the acces modifiers for base class and we need to manipulate the private data of base class in derived class. Is there anyway to acces the private data members? Here's a coding example

class A {
private :
int a;
};
class B : public class A {
public :
void displayA() { cout<<a<<endl; }
};

how i can acces the a of base class A in derived class B without acces modifiers.

View 16 Replies View Related

C/C++ :: Access Video Memory Of Console?

May 1, 2014

I'm currently stuck whit a problem. I would like to access video memory of the console(Yes, only the black box) in C. I know how to do it in turbo pascal :

Var
video:array[0..4000] of char absolute $B800:0000;

But i don't know the numbers in C. I've searched for the numbers of the memory in C but i can't find it.

View 7 Replies View Related

Visual C++ :: How To Calculate PCA / Memory Access Violation

Mar 23, 2013

I am trying to use PCA, but it gives memory access violation error. Here is my sample code.

Code:
int main(...) {
.................
vector<float>input_array;
for(i=0;i<number_of_lines;i++) {
for(j=0;j<feature_vector_size;j++) {
input_array.push_back(read_feature[i][j]);

[code]....

View 1 Replies View Related

C++ :: Pointers And Images - Memory Access Violation

Nov 20, 2014

I get a memory access violation when I run the below code. void createNewImage(int width, int height); this function deletes any current image data and creates a new image with the specified width/height and allocates the needed number of pixels dynamically. The new image contains four blocks with different color, red, blue, green, and black.

Code:
#include <iostream>
#include "image.h"
image::image() {
pixels = NULL;
width = 0;
height = 0;

[Code] .....

View 2 Replies View Related

C++ :: Invalid Access To Memory Location Using GlobalFree

Jan 11, 2013

Under Microsoft, I use GlobalAlloc and GlobalFree to dynamically allocate and free memory. Intermittently GlobalFree is reporting error 998 (GetLastError() - Invalid access to memory location). I've checked my logs of addresses returned by GlobalAlloc against those being freed by GlobalFree and when the problem occurs the address causing the error has been allocated by GlobalAlloc and has not been freed before since allocation.

I can't reproduce it. Currently I'm checking for error 998 from GlobalFree and ignoring it if it occurs - which is not satisfactory. I have one function (AllocMem) that calls GlobalAlloc and checks for errors and another function (FreeMem) which calls GlobalFree and checks for errors.

My program uses AllocMem and FreeMem everywhere memory is required or freed. AllocMem and FreeMem are in a DLL. The program is heavily threaded and a different thread may call AllocMem to the one that calls FreeMem. I don't believe I've got a race condition etc as all the code in the program containing the AllocMem and FreeMem calls are part of a CriticalSection using the same variable.

What is a possible cause of this error?

View 14 Replies View Related

C++ :: How To Write Functions To Access Various Fields

Sep 16, 2013

Question: How can we write functions to access various fields?

Example: A phone number -- it has an area code, exchange & subscriber -> (123)-456-7890

How can we write a function to access the various fields of a phone number both in a particular class & in the main?

View 5 Replies View Related

Visual C++ :: Debugging Access Write From Error Message

Aug 12, 2013

I have a crash on a application the customer machine i couldn't reproduce it yet on my machine... all i have is the error message

The Instruction 0x0070478b referencing to the memory 0x00000000 could not be written.

And that's all i have how do i track that instruction on my program from that address? is it possible?

View 4 Replies View Related

C :: Write At Random Memory Locations

Jan 29, 2014

I have a complex program, around 25.000 code lines. It is quite stable, but I have a bug which only happens from time to time, and when in online-mode, so it is quite difficult for me to reproduce it. I have put lot of efforts to see where the problem is, and I have seen where the code crash, but that line is not the culprit, it only refers to read a memory location where it is supposed to be good data, and it is not. The real bug has happens before in execution. That data is read-only, I mean, I only compute it at program start-up, and then never write into it again, but my bug write to it doring code run, maybe because bad pointers address in any place, and look ramdom (different snapshots execution write at different memory locations).

My question is, is there a way to know when my code 'write' into that 'to me protected memory'? I thinking if there is a method to make a hash of all variables and arrays in that memory section, or any way to 'assert' when that big memory section is written, taking into accound that when I refer to that memory section it could be any of the lots of variables and arrays I precompute at start-up.

View 2 Replies View Related

C++ :: Write Process Memory Bytes

Apr 8, 2014

Writing bytes to external process to remove a detour that the program does

this is what im trying it fails

HANDLE Handle = OpenProcess(PROCESS_ALL_ACCESS, false, ProcessId);

BYTE btLdrLoadDll[] = { 0x8B, 0xFF, 0x55, 0x8B, 0xEC };

if (!WriteProcessMemory(Handle, (BYTE*)((DWORD)GetProcAddress(GetModuleHandle("ntdll.dll"), "LdrLoadDll")), &btLdrLoadDll, sizeof(btLdrLoadDll), NULL)) {
CloseHandle(Handle);
std::cout << "
Failed to write Bytes to memory. Press enter to exit.";

[Code] ....

an also using the right address like this fails

WriteProcessMemory(Handle, (BYTE*)0x77C64F9F, &btLdrLoadDll, sizeof(btLdrLoadDll), NULL)

View 8 Replies View Related

C :: Read / Write To File

Mar 3, 2013

How can I erase the data stored in /tmp/a.txt after every run of this code?

Code:

#include <stdio.h> // IO operations
#include <unistd.h> //for pid, ppid, fork functions
#include <sys/types.h> //for pid_t type, kill function
#include <stdlib.h> //for exit function
#include <signal.h> //for kill function
#include <sys/types.h>
#include <sys/stat.h>

[Code]...

View 3 Replies View Related

Visual C++ :: Read And Write XML?

Sep 8, 2013

I receive a telegram in XML format and I need to parse it and send my data in the same format back. My main problem is that I'm not allowed to use any open source software or other 3rd party software except VS2010. I have to write it in C++.

Now my question: is there any good tutorial for such a parser? I was hoping that I could write something which can be used similar to the GEtPrivateProfil-functions which are handy for ini-files.

My XML telegram looks like hat:

Code:
<Tag0 cmdId=“254“ version=“1“ ID=“87951“ action=“doing1“>
<!—comment1 -->
<Tag1 lId=“31“ type=“12“ index=“100“ state=“open“ />
<Tag1 lId=“31“ type=“12“ index=“135“ state=“open" />
<!—comment2 -->
<Tag2 lId=“42“ type=“32“ index=“2“ state=“open" >
<param key=“pos“ value=“center“ />
<param key=“car“ />
</epr>
</Tag0>

I was hoping to find a way to get to know how many tag1 and tag2 are in tag0 and then get for each tag the attributes and sub-tags like param in tag2

View 13 Replies View Related

C++ :: Read Byte Of Char Data And Convert It Into Text String Of Binary Data That Represents Hex Value

Dec 26, 2013

I am writing a program where I need to read a byte of char data and convert it into a text string of binary data that represents the hex value...

i.e. The char byte is 0x42 so I need a string that has 01000010 in it. I've written the following subroutine....

------------- My Subroutine ----------------------------------------------------------------------
void charbytetostring(char input, char *output){
int i, remainder;
char BASE=0x2;
int DIGITS=8;
char digitsArray[3] = "01";

[Code] ....

When I submitted the byte 0x42 to the subroutine, the subroutine returned to the output variable 01000010... Life is good.

The next byte that came in was 0x91. When I submit this to the subroutine I get garbage out.

I am using a debugger and stepped through the subroutine a line at a time. When I feed it 0x42 I get what I expect for all variables at all points in the execution.

When I submit 0x91 When the line remainder = input % BASE; gets executed the remainder variable gets set to 0xFFFF (I expected 1). Also, when the next line gets executed..

input = input / BASE; I get C9 where I expected to get 48.

My question is, are there data limits on what can be used with the mod (%) operator? Or am I doing something more fundamentally incorrect?

View 6 Replies View Related

C :: How To Read File Directly From Memory Buffer

Jan 20, 2014

I have a C program. Within it, I would like to embed either a file or a pre-assigned variable. I would prefer a method that is platform independent.

I am using the data type "RSA" from <openssl/rsa.h>. I have a key file in PEM format, but I would like to embed an RSA object in the program instead. I tried creating a char array and then casting the pointer, but that caused some sort of illegal casting issue. I tried using memcpy but I haven't been able to get it working that way. What is the best way of going about this? Is it possible to read a file directly from a memory buffer?

View 1 Replies View Related

C :: Shared Memory / Cannot Read Last Element In A Struct

Jun 27, 2014

I have trouble reading the last element in a struct.I do get the correct value for the first two elements. In my example that is:

a = 11 and c = H
however I get:
b = 0
but I am expecting b=2

I got two files to handle this.The first one is writing data to memory -

Code:

#include <sys/shm.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
}

[code]....

why I cannot get correct value for the third element in my struct?In the second file where I'm reading from memory I allocate some space. Is this incorrect in some way? I'm running this on a Linux machine.

View 2 Replies View Related

C++ :: Read Variables And Methods Of Another Program In Memory?

Jan 16, 2013

i want to write a program that can access to variables and methods of another program. I ques for access to variables need to read memory, but about methods?how i can use methods and call them?

View 1 Replies View Related

C :: Opening File - Read / Write

Aug 5, 2013

this is my read/write functions based the read from the last post! then went nuts with it! used the %19s%*s on the write to the file, solved all the probs on the read side! but any refining on this would be great. This is another program that i started with the forums, and started going my own direction!

Code:

void WriteAccount(int account,char *a[])
{
FILE *fptr;
char Memo[20];
char buff[20];
double Amount;
struct tm *sTm;
}

[code]....

the a[] is a string array with bank account names, and Account is the number on the menu based list.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved