Computing.Net > Forums > Programming > C++ find char/outputting in strings

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C++ find char/outputting in strings

Reply to Message Icon

Name: spark101
Date: June 11, 2003 at 15:15:25 Pacific
OS: winXP
CPU/Ram: 1.8ghz, 512mb
Comment:

In C++ I'm writing a log reader for the game neverwinter nights. It takes the txt log and converts it into html.

the log is just a txt with the following format:

name: [talk] chat text

where [talk] is, it could be [shout], [tell], it's just the type of chat it is.

Now, I'd like to add a to the beginning of each line, which I can do. What I can't do is add a after the first ":" in each line, and then tags before and after each [chat] part.

Can someone help me out with this?

Here's the loop that prints the meat of the log to the html file:

while(txt.eof() == 0)
{
txt.getline(temp, max);
html " \n";
}



Sponsored Link
Ads by Google

Response Number 1
Name: bitbyte
Date: June 12, 2003 at 08:53:24 Pacific
Reply:


temp is the outputtxt;
temp is the chat txt
inserttxt is the text you want to insert
you have to change the sizes as you need

int i;
char temp[255],temp2[255],inserttxt[255];

for (i=0;i4;i++) temp[i]=temp2[i];
temp[i]=0x00;
strcat (temp,inserttxt);
strcat (temp,temp2+i);


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C++ find char/outputting in strings

C++ find and replace in a textfile www.computing.net/answers/programming/c-find-and-replace-in-a-textfile/13921.html

C character subst. in string www.computing.net/answers/programming/c-character-subst-in-string/9739.html

Char Error in C++ www.computing.net/answers/programming/char-error-in-c/18600.html