Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Copy String structure "A" to string structure "B"
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Leo Nunez, post: 2403825"] Hello! I need copy from structure "A" to "B" that contains "strings" in a one line code. Me problem like this : typedef struct tHeader{ char field1[4]; char field2[3]; char field3[2]; char field4[1]; }; struct tHeader Header,*pHeader; char buffer[100]; pHeader=&Header; strcpy(buffer,"ABCDEFGHIJKLMNOPQRSTUVWXYZ"); memcpy(pHeader,&buffer,sizeof (struct tHeader)); printf("field1 : %s : ",pHeader->field1); printf("field2 : %s : ",pHeader->field2); printf("field3 : %s : ",pHeader->field3); printf("field4 : %s : ",pHeader->field4); What i need ? pHeader->field1 ==>"ABCD" pHeader->field2 ==>"ABC" pHeader->field3 ==>"AB" pHeader->field4 ==>"A" Someone helpme ? Cheers! [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Copy String structure "A" to string structure "B"
Top