Javascript required
Skip to content Skip to sidebar Skip to footer

Error Reading Characters of String in C

Question C++ Service Crash in Windows Server 2008 R2 Auto

29-Jul-fifteen viii:26

Member janaswamy uday 29-Jul-15 8:26
Hi All,

While running a C++ Service in Wice indows 2008 Server i got below dump for service crash.

Crash Dump
------------

00 ntdll!ZwWaitForMultipleObjects+0xa
01 ntdll!RtlReportException+0x55e
02 ntdll!RtlReportException+0xbc
03 ntdll!RtlpNtMakeTemporaryKey+0x216
04 ntdll!_C_specific_handler+0x96
05 ntdll!wcstok_s+0x34be
06 ntdll!_chkstk+0x9d
07 ntdll!RtlRaiseException+0xf67
08 ntdll!RtlRaiseException+0x18d
09 ntdll!RtlpNtMakeTemporaryKey+0x1c0
0a ntdll!RtlpNtMakeTemporaryKey+0x3402
0b ntdll!RtlpNtMakeTemporaryKey+0x4000
0c ntdll!memset+0x160da
0d msvcr110!gratuitous+0x1c
0e wincli32!ConnectDlg+0x392
0f wincli32!OsGetCOPCLIVersion+0x7fed
10 ntdll!RtlActivateActivationContextUnsafeFast+0x114
11 ntdll!LdrShutdownThread+0x116
12 ntdll!RtlExitUserThread+0x3e
13 kernel32!BaseThreadInitThunk+0x15
14 ntdll!RtlUserThreadStart+0x34

please help me out.

Cheers,
Uday

Question Re: C++ Service Crash in Windows Server 2008 R2 Machine

Richard MacCutchan 29-Jul-15 22:ten

mve Richard MacCutchan 29-Jul-15 22:10

janaswamy uday wrote:

delight assist me out.
With what? No ane here has the remotest idea what plan(due south) you are running or where this error may have occurred.
General Who has the type of remote control lawmaking, can you give me a copy?

HackLee 27-Jul-15 17:twenty

Member HackLee 27-Jul-15 17:twenty
General Re: Who has the type of remote command code, tin can you give me a copy?

enhzflep 27-Jul-fifteen 19:19

Member enhzflep 27-Jul-15 nineteen:19

Here's a quick run-downward of the NEC protocol. http://techdocs.altium.com/display/FPGA/NEC+Infrared+Manual+Protocol[^]

And here'south some more than full general stuff: https://en.wikipedia.org/wiki/Consumer_IR[^]

A good identify to look for the actual data/commands sent using the various protocols is in the microcontroller community. The Arduino/8501 forums/libraries have plenty of code available.
I once setup an arduino to record the incoming pulses from a remote. I then swapped the IR receiver module for a cheap 1mw laser - I tin can control the IR equipment from over 100m abroad at present. Shucks | :-\

Unfortunately, the code'due south on a auto I dont have access to now and I've long since forgotten where I got the info from, lamentable.

"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew upward. I wrote downwards 'happy'. They told me I didn't understand the assignment, and I told them they didn't empathise life." - John Lennon


General Re: Who has the type of remote control code, can you give me a copy?

HackLee 27-Jul-15 20:42

Member HackLee 27-Jul-fifteen 20:42

Thank. Smile | :)
General Re: Who has the blazon of remote command code, can you give me a copy?

HackLee 27-Jul-fifteen xx:41

Member HackLee 27-Jul-15 20:41

........
Question Error reading characters of string

Django_Untaken 27-Jul-15 10:nineteen

Member Django_Untaken 27-Jul-fifteen 10:19
Hi there. I have this construction in Header1.h and instantiating this structure in Header2.h. When I try to initialize this instance, I get this runtime exception. Here is my skeleton of code
                                                              HEADER1.h                                                            struct                              Pupil {     CString Name;     CString Address;     CString Telephone; };                                                              HEADER2.h                                                            class                              CHeader2Dlg {          Student educatee;      }                                                              HEADER2.cpp                                                            void                              CHeader2Dlg::SomeFunction() {     student.Name =                              "                              ";      pupil.Address =                              "                              ";     student.Telephone =                              "                              ";  }

Answer Re: Error reading characters of string

Richard Andrew x64 27-Jul-15 10:54

professional Richard Andrew x64 27-Jul-15 10:54

Are you lot possibly using the Unicode grapheme prepare but assigning an ascii string?

Perchance it should be:

pupil.Name = L"                              ";

The difficult nosotros do right away...
...the impossible takes slightly longer.


General Re: Mistake reading characters of string

Django_Untaken 27-Jul-15 19:06

Member Django_Untaken 27-Jul-xv 19:06

I inverse that to L"" only in vein. Does it have to do annihilation with project settings ?
Answer Re: Error reading characters of cord

Richard Andrew x64 27-Jul-15 xix:21

professional Richard Andrew x64 27-Jul-xv 19:21

I suspect there is something more than going on than merely the code you have posted. It sounds as if the CString object is not being instantiated.

Perchance if you could post more, relevant lawmaking.

The difficult nosotros practice right away...
...the impossible takes slightly longer.


General Re: Fault reading characters of cord

Django_Untaken 27-Jul-fifteen xix:32

Member Django_Untaken 27-Jul-15 19:32

                              Header1.h                              struct                              Account {     CString Name;     CString Address;     CString Phone; };                              Header2.h                              class                              AccountDlg :                              public                              CDialog {         Business relationship account;     }                              Header2.cpp                              void                              AccountDlg::Load(int                              id) {     CEdit* edit;     CComboBox *combobox;      account.Proper noun=                              "                              asd";       account.Address=                              "                              asd";     business relationship.Phone =                              "                              asd";      accountId = id;     accountSettings.AccountLoad(accountId,account);       }

Answer Re: Fault reading characters of string

Richard Andrew x64 27-Jul-15 19:58

professional Richard Andrew x64 27-Jul-fifteen xix:58

That doesn't reveal anything more than the first post. I think you should mail the bodily lawmaking, non an obfuscated version of it.

Testify the "#includes" too.

The difficult we exercise correct away...
...the impossible takes slightly longer.


Answer Re: Fault reading characters of string

Albert Holguin 28-Jul-15 vii:23

professional Albert Holguin 28-Jul-15 7:23

Take y'all tried explicitly calling the struct'due south constructors in the grade constructor?
                              class                              AccountDlg:                              public                              CDialog {   Business relationship business relationship;    public:         AccountDlg() : account() {} }

Question Re: Error reading characters of string

Richard MacCutchan 27-Jul-fifteen 22:02

mve Richard MacCutchan 27-Jul-xv 22:02

Django_Untaken wrote:

Here I am getting the said exception
What exception?
Answer Re: Mistake reading characters of cord

Django_Untaken 28-Jul-15 seven:26

Member Django_Untaken 28-Jul-15 7:26

Admission violation reading location. Merely earlier this exception, if I debug the application, I encounter that member variables of this object dont evidence and Error reading characters of cord shows up instead, in the intellisense.
General Re: Error reading characters of string

Richard MacCutchan 28-Jul-15 7:34

mve Richard MacCutchan 28-Jul-15 7:34

That suggests that you have non initialised the object. Have you checked that the constructor is called and sets all the variables correctly?
General Re: Error reading characters of string

SundararamanS 29-Jul-15 0:39

Member SundararamanS 29-Jul-xv 0:39

Information technology does not look like yous are reading the cord, y'all are actually assigning values. It seems the exception is from somewhere else.. Is this the complete lawmaking you are debugging ?? Could yous delight share the total code if possible ?
Question Accessing / press two dimensional array of char using pointers

Vaclav_ 26-Jul-xv 5:06

Member Vaclav_ 26-Jul-fifteen 5:06
I am still struggling with pointers arithmetic.
Hither is my crude exam code.
I want to use pointers to access ( double - demand triple somewhen) the array of characters and do not get two things.

Problem #1 is probably how does the LCD course do the "print" and I can figure that one by myself. I exercise non expect this forum to exist familiar with Arduino "library".

Problem # 2
I can print single characters in simple assortment past incrementing the pointer, but I cannot figure out why I cannot utilise same method on double assortment.
I actually do not understand what is this error telling me
"error lvalue required as increment operand" - what is "lvalue" ?

Delight keep in mind that English language is not my native language so go like shooting fish in a barrel on
" pointers to array..." "array of pointers" etc.

Equally always , I appreciate your help.
Cheers
Vaclav

Addendum
OK, I did some more reading nearly how the array is initialized and how the NAME of the array cannot be used the way I did try it.

And then I did this - information technology "works" , merely I am still not sure if it is correct or merely a fluke.

char *arrow = stringTable[0];
lcd_i2c.print((char*) pointer++); // prints entire line
lcd_i2c.impress((char*) pointer); // prints entire line starting with 2d character - expected that

Original postal service code starts here
char line[MAX_LINE] = "A TEST B";
int ncharacters = strlen(line);

char *sptr; // pointer to retention cake returned by malloc
char *stringTable[NLINES]; // assortment of pointers to string
int i = 0;
sptr = (char*) malloc((unsigned) strlen(line) + i);

lcd_i2c.clear();
lcd_i2c.print("Alphabetize ");
lcd_i2c.impress(i);
lcd_i2c.setCursor(0, one);

lcd_i2c.print("Length ");
lcd_i2c.print(ncharacters );

lcd_i2c.setCursor(0, 2);
lcd_i2c.print("arrow ");
lcd_i2c.print(sptr); // problem #one prints the unabridged line - non really a trouble here

strcpy(sptr, line); // copy line to pointed memory
lcd_i2c.print(sptr); // TOK prints pointer value ?
// re-create pointer to starting time table array
stringTable[0] = sptr;
lcd_i2c.setCursor(0, iii);
i = 0;
do
{
// TOK prints showtime character from stringTable[0]
lcd_i2c.print((char) * (*stringTable)); // trouble #ane prints only the first grapheme - why information technology would exist nice to print the entire line using pointers!

} while (*(*++stringTable)); fault lvalue required as increment operand

-- modified 26-Jul-15 eleven:18am.

Answer Re: Accessing / printing 2 dimensional array of char using pointers

Richard MacCutchan 26-Jul-15 6:51

mve Richard MacCutchan 26-Jul-15 6:51

Information technology'south really rather hard to effigy out what y'all are trying to do since some of the to a higher place code makes no real sense. Yous are using casts on pointers that are already pointers, so do nada except add confusion. You lot classify a block of memory then try to impress information technology before information technology contains anything. You create an array of ponters for no apparent reason and so use only the first 1, you copy data from one memory cake to another, again for no real reason, etc. Maybe you should show exactly what trouble y'all are trying to solve, without all this code and we can suggest on the best option. And an caption of what the impress function actually does, or is supposed to do.

Also delight apply <pre> and </pre> tags effectually your code so it is more readable, like this:

lcd_i2c.clear();   lcd_i2c.print("                              Alphabetize ");   lcd_i2c.print(i);   lcd_i2c.setCursor(0,                              1);                            

Answer Re: Accessing / printing two dimensional array of char using pointers

enhzflep 26-Jul-15 7:47

Member enhzflep 26-Jul-15 7:47

Well, you tin can easily expect at the information-sheet for the I2C scrap on the LCD lath and at the ane for the 1602/1604/2002/2004 LCD you're using. In one case done, you can see that the LCD has a hardware cursor, and knows at which position on the display it is. It also has a means to write a character to the current cursor position.
Here'due south a quick list of the bachelor commands: http://world wide web.8051projects.net/lcd-interfacing/commands.php[^]
Not covered in that particular document, is the fact that y'all define custom bitmaps for characters - up to four or so at whatever once. Y'all could for instance, brand a bitmap of a battery and so animate a charging display by changing the bitmap used for the battery 'grapheme'.(but not actually irresolute the character drawn - information technology's the bitmap that this character refers to that is changed)

Here's a tool I whipped-up a couple of years back that makes cartoon such custom characters piece of cake. I've used this for both ascii/graphical LCDs - I don't remember if the output was suitable for both or simply one or the other.
Lcd Character designer The 'save' push causes the changes made to a character in the top-pane to be written to the 'memory' of the LCD panel and causes the appearance of the currently chosen character to change.

As for the arrow stuff, you seem to be making it considerably more complex than it needs to exist.
Here's a quick sample. I dont accept admission to an arduino this moment, so have used printf instead.

                              int                              main() {                              char                              *stringTable[] = {                              "                              string 1",                              "                              string 2",                              "                              string three", NULL };                              int                              i, north =                              sizeof(stringTable) /                              sizeof(*stringTable);                                    for                              (i=0; i<n-1; i++)         printf("                              (%d chars): %s\n", strlen(stringTable[i]), stringTable[i]);      printf("                              -------------\northward");                                    char                              **curPtr = stringTable;                              do                              {         printf("                              %due south\northward", *curPtr);            curPtr++;                       }                              while                              ( *curPtr );            }

"When I was 5 years old, my mother always told me that happiness was the central to life. When I went to school, they asked me what I wanted to be when I grew upwards. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't empathize life." - John Lennon


General Re: Accessing / press two dimensional assortment of char using pointers

Vaclav_ 26-Jul-xv 8:35

Member Vaclav_ 26-Jul-xv 8:35

Thanks,
basically you confirmed that I need a arrow to the double dimension array.
That is all I wanted to know.
Cheers
Vaclav
Question Re: Accessing / printing two dimensional array of char using pointers

CPallini 26-Jul-xv 21:49

mve CPallini 26-Jul-15 21:49

Why are you using both a sentinel value and the array size (just out of curiosity)?
Answer Re: Accessing / printing two dimensional array of char using pointers

enhzflep 27-Jul-fifteen 1:54

Member enhzflep 27-Jul-xv 1:54

Simply to show ii ways of doing the same thing. Vaclav's code expects a sentinel, while I adopt to piece of work without one. Smile | :)

"When I was 5 years old, my mother always told me that happiness was the primal to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the consignment, and I told them they didn't sympathise life." - John Lennon


General Re: Accessing / printing two dimensional array of char using pointers

Vaclav_ 27-Jul-15 16:23

Member Vaclav_ 27-Jul-15 xvi:23

Ok I think I am getting the picture.
But I cannot effigy out how to implement same pointer arithmetic in double assortment.
I got the start "record" working fine, can access all strings / fields, but cannot go to the next one.

I am all the same not certain how does the pointer , and not the char in array , get incremented.

I have deleted the LCD code which confused many and added printf , which is not part of "core" Arduino code , and so this should pass by them now.

I even so would like some verbal description of the assignment of pointer to the assortment.
Appreciate your help very much.
Cheers
Vaclav

<pre lang="c++"> // double array of pointers
char *stringTable[][v] = {{ "string 1", "string two", "string three", Zip },
{ "2nd cord 1", "2d string two", "second string three", Nada }

};

char **curPtr = *stringTable; // pointer to array of pointers

do
{
printf("%due south\n", *curPtr++); // dereference to get the ptr to the cord
} while ( *curPtr ); // quit loop when we become to our Naught pointer.<pre lang="c++"><pre lang="c++"></pre></pre></pre>

General Re: Accessing / printing two dimensional array of char using pointers

enhzflep 27-Jul-fifteen xix:12

Member enhzflep 27-Jul-15 19:12

No trouble, it'south ane of the bug that seems to beat-up people regularly. I more or less started with ASM, so it was a matter of sink or swim in brusque order.

How nigh this, does it assistance?

                              int                              principal() {                                   char                              *stringTable[][iv] = {                                 {                              "                              cord 1",                              "                              cord 2",                              "                              string three", Nothing },                                 {                              "                              second string 1",                              "                              second string two",                              "                              second string iii", Zero }                             };                              int                              y;                              for                              (y=0; y<                              sizeof(stringTable)/sizeof(stringTable[0]); y++)       {                              char                              **curPtr = stringTable[y];                              practise                              {             printf("                              %south\n", *curPtr++);         }                              while                              (*curPtr);         printf("                              ----\north");     } }

"When I was five years old, my mother always told me that happiness was the central to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote downwards 'happy'. They told me I didn't sympathize the assignment, and I told them they didn't understand life." - John Lennon


berrickbressibity.blogspot.com

Source: https://www.codeproject.com/Messages/5098716/WebControls/?display=PrintAll