c++ - Convert Decimal to ASCII -


I am having difficulty in using reinterpret_cast just to say right from that bat that I am not married to reinterpret_cast suggest major changes in

Feel free to do so before I show you my code, I will tell you what I am trying to do.

I am trying to get a file name from a Vector filled with data being used by a MIPS I processor. Basically what I do in my vector c ++ program in a vector from a test program for my processor, a binary compilation, all the hex from dump binary, all those integers of those hex integers in decimal and a datamemory vector which is the data The memory unit for my processor is also in the memory of me, so when my processor runs "signal direction" like "open f L "My C ++ OS emulator obtain a pointer to the beginning of the file name in my data collection. So keep in mind that the data storage is filled with ints, string, globe, local, all types of goods. When I am told that where the file name starts, I do the following:

The entire decimal integer element is being converted into its ASCII character representation, and then to see from left to right Whether the string ends, if not, simply load each character in a "filename" string. Do this until the string ends in memory and then store the file name in a table. . My difficulty is creating a file name from my memory

Here's an example of what I'm doing:

C ++ syntax (toggle plain text)

< pre> 1.Index vector NewVector ASCII filenames 2.0 240faef0 128,123,792 'ABC7' 'a' 3.0 240faef0 128,123,792 'ABC7' 'now' 4.0 240faef0 128,123,792 'ABC7' 'ABC' 5.0 240faef0 128,123,792 'ABC7' 'ABC7' 6.1 1234567a 243225 '' k2s0 'abc7k' 7.1 1234567a 243,225 'k2s0' 'abc7k2' 8.1 1234567a 243,225 'k2s0' 'abc7k2s' 9 // Exit Loop // 10.1 1234567a 243,225 'k2s0' 'abc7k2s'

C ++ syntax (toggle plain text)

: Here is the code that I have written so far To get the file name (.. I just have to test 1000 of my datamemory vector functionality 1000 this application is 1000 arbitrary)
  1.int i = 0; 2.int phase = 1000; // top-> A; 3.String file name; 4.ac * temp = reinterpret_cast & lt; Char * & gt; (DataMemory [1000]); // Change to Coro 5. cout & lt; & Lt; "A0:" & lt; & Lt; Top- & gt; A & lt; & Lt; Endl; // Pointer Supply 6.Cut & lt; & Lt; "Data:" & lt; & Lt; DataMemory [top-> A0] & lt; & Lt; Endl; // where my vector is pointed at 7.cout  

So this issue is that when I convert my decimal element to a four array, I think 8 hex # s will give me 4 letters. Is not there? Here is my output:

C ++ syntax (toggle plane text)

  1.a0: 0 2. Data 3. 3. Data (1000): 4428576 4. Consumer: 0x7fff5fbff128 5.Segmentation error  

not

your wires are null-terming, you want to do this

  10 while (temp [i]! = 0  

instad

  10 though (and temporary [i]! = 0)  

not sure Although I understand the datamma structure ...


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -