Re: How to divide and join variables of char type ??
From: Elephant (cleaner_at_codocadNOSPAM.com)
Date: 01/23/04
- Next message: Aggro: "Re: How to divide and join variables of char type ??"
- Previous message: Martijn Lievaart: "[OT] Re: using boost::any"
- In reply to: KPG: "How to divide and join variables of char type ??"
- Next in thread: Aggro: "Re: How to divide and join variables of char type ??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 23 Jan 2004 17:10:51 +0100
Not exactly clear what you want, maybe you can use memcpy()?
char c1[10];
char c2[5];
char c3[15];
// Copy first 5 char's from c1 to c2.
memcpy( c2, c1, sizeof(char)*5 ); // sizeof(char)*5 = 5.
// Copy last 5 char's from c1 to 2.
memcpy( c2, &(c1[5]), sizeof(char)*5 ); // &(c1[5]) == c1+(sizeof(char)*5).
// Join with other variables?
// Copy c1 and c2 to c3.
memcpy( c3, c1, sizeof(char)*10 );
memcpy( &(c3[10]), c2, sizeof(char)*5 );
"KPG" <mstepien@kpg.pl> schreef in bericht
news:bur62r$15c$1@nemesis.news.tpi.pl...
> I have char variable, for example
> char c[10];
> and I would like to divide this variable
> on two others char variables
> or join with oher char variables/
>
>
>
>
>
- Next message: Aggro: "Re: How to divide and join variables of char type ??"
- Previous message: Martijn Lievaart: "[OT] Re: using boost::any"
- In reply to: KPG: "How to divide and join variables of char type ??"
- Next in thread: Aggro: "Re: How to divide and join variables of char type ??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|