Storing byte array as string

S

shazrul

Hi all,

I have a byte array which I need to store in an Active Directory
attribute. The array has 256 elements.

The way I am doing it now is to convert each byte into a two digit Hex
pair for example,

byArray(0) = 01
byArray(1) = 255
byArray(2) = 128
....

will be stored as a string of 01 FF 80 ...

The problem with this approach is, I will need the Active Directory
attribute to hold 512 characters. How can I store the byte array in a
more space efficient way and at the same time, easy to parse when I
need to.
 
V

Victor Bazarov

shazrul said:
I have a byte array which I need to store in an Active Directory
attribute. The array has 256 elements.

So, something like

unsigned char array[256];

in C++, right? If not, you might want to explain what "an Active
Directory attribute" is.
The way I am doing it now is to convert each byte into a two digit Hex
pair for example,

byArray(0) = 01
byArray(1) = 255
byArray(2) = 128
...

will be stored as a string of 01 FF 80 ...

Why? What's wrong with storing it as an array of unsigned char?
The problem with this approach is, I will need the Active Directory
attribute to hold 512 characters. How can I store the byte array in a
more space efficient way and at the same time, easy to parse when I
need to.

Huh? Well, let me ask you again, what's wrong with an array of unsigned
char?

V
 
S

shazrul

Hi victor thanks for replying. You are right on that. I got confused
with the conversion, from/to unicode.

Victor Bazarov said:
shazrul said:
I have a byte array which I need to store in an Active Directory
attribute. The array has 256 elements.

So, something like

unsigned char array[256];

in C++, right? If not, you might want to explain what "an Active
Directory attribute" is.
The way I am doing it now is to convert each byte into a two digit Hex
pair for example,

byArray(0) = 01
byArray(1) = 255
byArray(2) = 128
...

will be stored as a string of 01 FF 80 ...

Why? What's wrong with storing it as an array of unsigned char?
The problem with this approach is, I will need the Active Directory
attribute to hold 512 characters. How can I store the byte array in a
more space efficient way and at the same time, easy to parse when I
need to.

Huh? Well, let me ask you again, what's wrong with an array of unsigned
char?

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top