Click to See Complete Forum and Search --> : reading and writing a buffer using fstream?


lab1
October 12th, 2005, 07:08 AM
Hello all,

I am reading a file and I want to read it into a buffer using fstream. anyone have any sample code to read and write files into a buffer?

Thanks!

Philip Nicoletti
October 12th, 2005, 07:17 AM
1) what type of buffer (string , char [])

2) do you want to read the entire file into memory at once ?

3) here is a link for sample code ...

http://www.nicoletti.50megs.com/cpp_notes/files/reading.html

lab1
October 12th, 2005, 07:27 AM
I am using string's so that would work.. I just want to read part of the file into memory.. kind of like in C how you would parse a comment like this:

/* blah blah blah */

So I want to read when I encounter the "/*" and then read until I encounter the "*/"


Later I want to write that comment back to another file

Thanks!

lab1
October 12th, 2005, 07:48 AM
Do you have any simple sample code for what I asked? I didnt understand the example in the link you posted :(

cilu
October 12th, 2005, 08:13 AM
[ moved thread ]