Click here to Skip to main content
15,900,524 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: HEAP CORRUPTION DETECTED! Pin
Rajesh R Subramanian25-May-09 1:57
professionalRajesh R Subramanian25-May-09 1:57 
QuestionNeed Help With Callback Functions [noob] Pin
LCARS x3224-May-09 22:22
LCARS x3224-May-09 22:22 
QuestionProblem in CeCreateProcess ? Pin
Le@rner24-May-09 22:16
Le@rner24-May-09 22:16 
AnswerRe: Problem in CeCreateProcess ? Pin
Randor 25-May-09 8:22
professional Randor 25-May-09 8:22 
GeneralRe: Problem in CeCreateProcess ? Pin
Le@rner25-May-09 18:59
Le@rner25-May-09 18:59 
GeneralRe: Problem in CeCreateProcess ? Pin
Randor 25-May-09 19:30
professional Randor 25-May-09 19:30 
GeneralRe: Problem in CeCreateProcess ? Pin
Le@rner25-May-09 19:33
Le@rner25-May-09 19:33 
GeneralRe: Problem in CeCreateProcess ? Pin
Randor 25-May-09 20:30
professional Randor 25-May-09 20:30 
GeneralRe: Problem in CeCreateProcess ? Pin
Le@rner25-May-09 23:15
Le@rner25-May-09 23:15 
GeneralRe: Problem in CeCreateProcess ? Pin
Le@rner26-May-09 18:40
Le@rner26-May-09 18:40 
GeneralRe: Problem in CeCreateProcess ? Pin
Randor 26-May-09 21:58
professional Randor 26-May-09 21:58 
GeneralRe: Problem in CeCreateProcess ? Pin
Le@rner26-May-09 22:21
Le@rner26-May-09 22:21 
QuestionGetting motherboard serial number Pin
Green Fuze24-May-09 21:40
Green Fuze24-May-09 21:40 
AnswerRe: Getting motherboard serial number Pin
Randor 25-May-09 8:12
professional Randor 25-May-09 8:12 
QuestionHow to set tab index. Pin
birajendu24-May-09 21:39
birajendu24-May-09 21:39 
AnswerRe: How to set tab index. Pin
sashoalm24-May-09 22:01
sashoalm24-May-09 22:01 
GeneralRe: How to set tab index. Pin
birajendu25-May-09 2:16
birajendu25-May-09 2:16 
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

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.