By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

How do you manipulate what is stored in a buffer?

P: 1
hi all
i have just managed to read a file and everything that is read is now stored in a buffer

what i now what to do is use the text upto a special marker which is in the file

-> file has text separated by a special character
-> file has been through a read function and stored everything in buffer
-> now i would like to separate the text according to the special character marker

how would i go about manipulating this text? how would i copy the text upto the special character marker and save it as a separate variable in my program so i can do other things with that?

all help is much appreciated
kind regards
Dec 12 '10 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 2,400
Are you using C or C++?

In C, you don't want to copy the text to a variable. You can only copy the text to a buffer that is pointed at by a variable. You will need to allocate that buffer and then copy text to it. You also need a way to recognize the end of the text -- either by appending a termination character to the buffer or by retaining a count of the characters in the buffer.
Dec 13 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.