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.
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.
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).
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:
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.
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];
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.
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.";
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".
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.
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?
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.
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?
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!
1. Design 1: Have an independent class to handle everything and "friend" it with the users. Pro: Only 1 interface needed and we can switch interface easily. Con: There is a lot of inter-class data which destroys encapsulation
class CalibratorXML; class Device{ string sourceLabel; string destLabel; vector<CalPoint> calPoints; friend class CalibratorXML;
I'm looking to write a program in C/C++ to traverse a Fasta file formatted like:
>ID and header information SEQUENCE1 >ID and header information SEQUENCE2
and so on
in order to find all unique sequences (check if subset of any other sequence) and write unique sequences (and all headers) to an output file.
My approach was:
Prep: Copy all sequences to an array/list at the beginning (more efficient way to do this?)
Grab header, append it to output file, compare sequence for that header to everything in the list/array. If unique, write it under the header, if not, go on.
However, I'm a little unsure as to how to approach reading the lines in properly. I need to read the top line for the header, and then "return?" to the next line to read the sequence. Sometimes the sequence spans more then two lines, so would I use > (from the example above) as a delimiter? If I use C++, I imagine I'd use iostreams to do the reading.
How to read some characters from file, I know we can move a pointer to some position using seekg() & seekp() function, get current position of the pointer through tellg() & tellp() functions. By moving the pointer to appropriate position using seekg(), we can read the whole line using getline() function. But is there any function which read certain characters from the current position of the pointer and write certain characters from current position of the pointer.
How to read some characters from file, I know we can move a pointer to some position using seekg() & seekp() function, get current position of the pointer through tellg() & tellp() functions. By moving the pointer to appropriate position using seekg(), we can read the whole line using getline() function. But is there any function which read certain characters from the current position of the pointer and write certain characters from current position of the pointer.
int main () { FILE * pFile; long lSize; char * buffer; size_t result; pFile = fopen ( "myfile.bin" , "rb" );
[Code] .....
How to open binary for read and write? Why the buffer is char * buffer? i mean in binary u cant read chars . How can it be? how the data is represented? just like txt file? What the buffer will contain how to print this buffer???
reading and writing 2D arrays I've been trying out a few tutorials using FileStream but I couldn't get any of them to work.
Anyway what I'm trying to do is save the playerArray to a .txt file and then read from that .txt into the fields within the GUI. This is supposed to act as a database.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data;
Explain me a working code to read and write a file using serial communication.and i need to store that file.I know normal file handling in C, but how it is through serial port i am not getting.
So I've been turning my programs into classes and I run into errors.
So this program is supposed to allow the user to open the file and either read or write to it.
I've omitted the read part from it as I want to attempt that on my own .
I get these compile errors:
fileclass.cpp:13: error: ISO C++ forbids declaration of ‘choice’ with no type fileclass.cpp:21: error: ISO C++ forbids declaration of ‘choice’ with no type fileclass.cpp: In member function ‘int file::choice()’: