Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / combining char*

Author
Message
CAJUN57
16
Years of Service
User Offline
Joined: 29th May 2008
Location:
Posted: 15th Jun 2008 20:02
how would i do somting like this



Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 15th Jun 2008 20:13
You can't do that like you would in BASIC. C++ is too close to machine code for the overhead involved in that sort of thing. You have to use the standard library of functions that comes with the language to pull such things off. I'll explain what you need to do but I'll also stipulate that you really need to pick up a book on C++ and read through it and understand it. You can't just pickup examples and expect to understand the language. Forums are okay for quick answers but insufficient for long term training.

Assuming that your initial three buffers can max out at 50 characters we have to provide more space for all

char *all = new char [151];

strcpy (all, bufferout); // copies the content of bufferout to all
strcat (all, ip); // appends (concatenates the content of ip onto all
strcat (all, username); // appends username to all

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
SpaceMan Infinity
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location:
Posted: 18th Jun 2008 18:30
Yes, there are complex string commands that I don;t even understand
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 18th Jun 2008 18:39
These aren't particularly difficult but they're not as straight forward as adding text in some other languages. Using a string class is a bit easier, though you still lose some control by having to mostly depend on class methods instead of your own pointers. I've never been comfortable with left$, right$ and mid$ type functionality, so I tend to roll my own.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Jason C
16
Years of Service
User Offline
Joined: 19th Jun 2008
Location:
Posted: 20th Jun 2008 00:46
sprintf is a great function to use.

Login to post a reply

Server time is: 2024-09-29 23:34:25
Your offset time is: 2024-09-29 23:34:25