|
-
September 6th, 2006, 05:50 PM
#1
cyping float into char array( or byte array )
Hi,
I want to copy say 100 floats and store them as char array.
This is what I have in mind, considering VC++ MSDN says on 32 bit flaot is 4 bytes and char is 1 byte
char *temp = ( char* ) &floatVal;
char arr[ 20 ];
for( int i = 0; i < 4; i++ ){
arr[ i ] = temp++;
}
i don't even know if this will work.
can memcpy do this kinda thing?
like memcpy( arr, &floatval, sizeof( float ) );
I r4eally have no idea how to approach this.
basically the problem is I want a char array of floating point values.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|