Hi
i got an Access Violation error with AnsiStrings n char*. First chance exception at $7C812A5B. Exception class EAccessViolatio n with message 'Access violation at address 0040467E in module 'Serial.exe'. Write of address 0518F503'. Process Serial.exe
the code is here: - AnsiString temp = Hex2Ascii(APDUCmd, index);
-
-
AnsiString Hex2Ascii(char *Hex, unsigned int HexLen)
-
{
-
char *AsciiChar = "0";
-
AnsiString temp;
-
Hex2Ascii(Hex, AsciiChar, HexLen);
-
temp = AsciiChar;
-
return temp;
-
}
actually i hav another Hex2Ascii function: - AnsiString Hex2Ascii(AnsiString HexAnsi, unsigned int HexLen)
-
{
-
char *AsciiChar = "0";
-
char *HexChar = HexAnsi.c_str();
-
AnsiString temp;
-
Hex2Ascii(HexChar, AsciiChar, HexLen);
-
temp = AsciiChar;
-
return temp;
-
-
}
APDUCmd is a char array:
if i call Hex2Ascii with array length less than 53, it calls AnsiString Hex2Ascii(AnsiS tring HexAnsi, unsigned int HexLen) and no error.
if greater than or equal 53, it calls AnsiString Hex2Ascii(char *Hex, unsigned int HexLen) and Access Violation error occurs.
Can anyone help me solve this?
1 5992 sicarie 4,677
Recognized Expert Moderator Specialist
Hi
i got an Access Violation error with AnsiStrings n char*. First chance exception at $7C812A5B. Exception class EAccessViolatio n with message 'Access violation at address 0040467E in module 'Serial.exe'. Write of address 0518F503'. Process Serial.exe
the code is here: - AnsiString temp = Hex2Ascii(APDUCmd, index);
-
-
AnsiString Hex2Ascii(char *Hex, unsigned int HexLen)
-
{
-
char *AsciiChar = "0";
-
AnsiString temp;
-
Hex2Ascii(Hex, AsciiChar, HexLen);
-
temp = AsciiChar;
-
return temp;
-
}
actually i hav another Hex2Ascii function: - AnsiString Hex2Ascii(AnsiString HexAnsi, unsigned int HexLen)
-
{
-
char *AsciiChar = "0";
-
char *HexChar = HexAnsi.c_str();
-
AnsiString temp;
-
Hex2Ascii(HexChar, AsciiChar, HexLen);
-
temp = AsciiChar;
-
return temp;
-
-
}
APDUCmd is a char array:
if i call Hex2Ascii with array length less than 53, it calls AnsiString Hex2Ascii(AnsiS tring HexAnsi, unsigned int HexLen) and no error.
if greater than or equal 53, it calls AnsiString Hex2Ascii(char *Hex, unsigned int HexLen) and Access Violation error occurs.
Can anyone help me solve this?
In your recursive call, you pass it three variables (HexChar, AsciiChar, HexLen), instead of the two that are declared. Other than that, I'm not too sure what might be going on there... Anyone else have an idea?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: dinks |
last post by:
Hi,
I'm new to C++ and have been assigned a task which i dont completely
understand. Any help would be greately appreciated.
Here is the problem:
The class "linkedListType" use the "assert" facility. I am to get rid
of them and replace them with exceptions. I need to create a
"linkedListException" class that's declared and implemented in my
"linkedListType" class. This class needs to inherit from the base
"exception" class and return...
|
by: Allan Ebdrup |
last post by:
Hi
I'm having a discussion with another programmer about a best practice for
thrownig exceptions. I want to create a rich class library with many
different exception classes in their own namespace, so they are easy to find
with intellisense. He wants to just throw Exception or one of the build in
exceptions. Do you have some good arguments for creating your own exception
classes even though they are little more than a type strongname and...
|
by: Divick |
last post by:
Hi all,
I want to subclass std::exception so as to designate the type
of error that I want to throw, out of my classes, and for that I need
to store the messages inside the exception classes. I want to use
std::string to do that so that I don't have to deal with all the hustle
of dealing with char *'s but as listed in the page (see link) below, it
is not advisable to use std::string in my exception classes.
The rational given is not...
|
by: Carl J. Van Arsdall |
last post by:
So this is probably a fairly basic question, but help me out because I'm
just not lining things up and I'm somewhat new to the world of exception
handling.
What's the benefit to inheriting an exception from and of the available
parent exception classes? Does one subclass have benefits over any
other? Most of what I see involves making a new class and inheriting
from Exception so that one can have an exception class with a name of...
|
by: michael |
last post by:
Hello everybody,
I've created for one of my classes a exception class derivated from
System.Exception. This exception class is public and lies within my
class as inner class.
When I throw this exception I can't catch it with its name! When I try
to catch it with it's name then the catch-block will be ignored.... So
I've made a general catch with System.Exception and printed the
runtime type...
| |
by: Joel Koltner |
last post by:
I have a generic (do nothing) exception class that's coded like this:
class MyError(exceptions.Exception):
def __init__(self,args=None):
self.args = args
When I attempt to raise this exception via 'raise MyError' I get an exception
within the MyError constructor __init__ as follows:
Traceback (most recent call last):
|
by: Bob Altman |
last post by:
Hi all,
We have a native class modeled after the System::Exception class, and all
exceptions that we throw derive from this class. For now this class is
quite simple: just Description and InnerException public members. One of
these days I'll dig into how to implement a StackTrace property (I assume
that this is possible using something like dbghelp.dll, but I've never had
the time to look into it).
I've recently written a managed...
|
by: amphetaman |
last post by:
If I derive my own Exception class from std::runtime_error, do I have
to write the destructor even if its body is empty?
#include <stdexcept>
class Exception : public std::runtime_error
{
public:
explicit Exception(const std::string &description) :
std::runtime_error(description) { }
|
by: Tony Johansson |
last post by:
Hello!
If I want to create my own Exception class which class is the recommended
class to derive from.
Should it be from Exception or from System.ApplicationException.
//Tony
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |