|
-
September 24th, 2002, 10:36 AM
#1
Need some help
This is with reference to my earlier post
I have a file now in say, path: F:\Develop\FILE -where "FILE" is the file I have to read from.
This path is stored in
string R_path;
I wanted to read from this "FILE" & put the contents(binary) in an ofstream;
I did something as follows:
ofstream m_ResourceGroup;
m_ResourceGroup.open("ResourceGroup",ios_base: ut|ios_base::binary);
char buffer[10];//Here I have to know the size of file,Iam giving 10 arbitarily.
ifstream r2(R_path.c_str(),ios::in|ios::binary);
r2.read(buffer,sizeof(buffer));
m_ResourceGroup.write(buffer,10);
Is there a better way of writing it?,because I have to know the size of buffer in the way I have done it & if I "cout" it shows some junk values behind the data.
The code shouldn't be windows dependent.
Thanks in advance..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|