Click here to Skip to main content
15,880,796 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to set tab index. Pin
Hamid_RT24-May-09 22:52
Hamid_RT24-May-09 22:52 
GeneralRe: How to set tab index. Pin
birajendu25-May-09 0:12
birajendu25-May-09 0:12 
QuestionGet Maximized SDI application Pin
Saleem Anwar24-May-09 21:15
Saleem Anwar24-May-09 21:15 
AnswerRe: Get Maximized SDI application Pin
Rajesh R Subramanian24-May-09 21:33
professionalRajesh R Subramanian24-May-09 21:33 
GeneralRe: Get Maximized SDI application Pin
Saleem Anwar25-May-09 1:15
Saleem Anwar25-May-09 1:15 
Questionstructure data to bytes conversion Pin
jalsa G24-May-09 21:02
jalsa G24-May-09 21:02 
AnswerRe: structure data to bytes conversion Pin
CPallini24-May-09 21:12
mveCPallini24-May-09 21:12 
GeneralRe: structure data to bytes conversion Pin
jalsa G24-May-09 21:23
jalsa G24-May-09 21:23 
hi sir,

Thanks for the reply

i am sending data over tcp socket so before sending i need to recalculate tcp checksum using md5.

so the structure data has to be split and divided header and data separately.


header is consist of 38 bytes and other data is message data.


so i am trying to split the structure data using below code


#include "stdafx.h"
#include <string.h>
#include <malloc.h>

struct Test
{

int sno;
char name[24];
int rno;

} testexmp;


unsigned long int x;
void dumpHex ( void *p, size_t size )
{
//int *list = malloc(n* sizeof(int));
unsigned char *bytes = (unsigned char *)p;

for (size_t i = 0 ; i < size ; i++ )
{
unsigned int b = bytes[i];


if (b>3)
{
printf(" i=%d 0x%02x \n",i,(char*)bytes[i]);

}
}
}


int main(int argc, char* argv[])
{

printf("size of the test structure is %d \n",sizeof(testexmp));

testexmp.sno=1;
strcpy(testexmp.name,"testsample");
testexmp.rno=10;


//here i split the data but i am unable to store them into other array

dumpHex(&testexmp,sizeof(testexmp));





printf("sno is %d \n",testexmp.sno);
printf("name is %s \n",testexmp.name);
printf("roll no is %d \n",testexmp.sno);



return 0;
}

Jalsa

GeneralRe: structure data to bytes conversion Pin
Cedric Moonen24-May-09 21:35
Cedric Moonen24-May-09 21:35 
GeneralRe: structure data to bytes conversion Pin
jalsa G24-May-09 22:45
jalsa G24-May-09 22:45 
QuestionMultiByteToWideChar fails in Vista (french) OS Pin
Sunil P V24-May-09 19:37
Sunil P V24-May-09 19:37 
AnswerRe: MultiByteToWideChar fails in Vista (french) OS Pin
Sunil P V24-May-09 19:47
Sunil P V24-May-09 19:47 
Answer[Message Deleted] [modified] Pin
sujeet24-May-09 19:50
sujeet24-May-09 19:50 
GeneralRe: MultiByteToWideChar fails in Vista (french) OS Pin
Joe Woodbury24-May-09 19:58
professionalJoe Woodbury24-May-09 19:58 
GeneralRe: [Message Deleted] Pin
Sunil P V25-May-09 2:37
Sunil P V25-May-09 2:37 
AnswerRe: MultiByteToWideChar fails in Vista (french) OS Pin
Joe Woodbury24-May-09 19:56
professionalJoe Woodbury24-May-09 19:56 
GeneralRe: MultiByteToWideChar fails in Vista (french) OS Pin
Sunil P V25-May-09 2:41
Sunil P V25-May-09 2:41 
GeneralRe: MultiByteToWideChar fails in Vista (french) OS Pin
Joe Woodbury25-May-09 8:33
professionalJoe Woodbury25-May-09 8:33 
GeneralRe: MultiByteToWideChar fails in Vista (french) OS Pin
Sunil P V25-May-09 18:53
Sunil P V25-May-09 18:53 
QuestionCxImage Class Conversion Pin
Muhammad Hassan Haider24-May-09 13:09
Muhammad Hassan Haider24-May-09 13:09 
AnswerRe: CxImage Class Conversion Pin
ThatsAlok24-May-09 18:29
ThatsAlok24-May-09 18:29 
AnswerRe: CxImage Class Conversion Pin
Hamid_RT24-May-09 20:55
Hamid_RT24-May-09 20:55 
GeneralRe: CxImage Class Conversion Pin
Muhammad Hassan Haider26-May-09 11:29
Muhammad Hassan Haider26-May-09 11:29 
GeneralRe: CxImage Class Conversion Pin
Hamid_RT27-May-09 1:23
Hamid_RT27-May-09 1:23 
QuestionCxImage Class Error Pin
Muhammad Hassan Haider24-May-09 2:27
Muhammad Hassan Haider24-May-09 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.