Urgent example needed

Hello I am currently working on a project ,but I need an example of the following pseudo-code:

Open sequential file for reading
Open Binary file for binary|writing
set position to 1
Read in a line from the sequential file
while(not sequential.eof())
{


That's all I need the rest I have figured out.

What are you doing in that while loop?
Oh, well in the while loop I am going to convert line into binary file object then I'm going to seek position and write record in binary file.
1
2
3
4
5
6
7
std::ofstream bin_stream(bin_filename, std::ios::binary);

std::string line;
std::ifstream txt_stream(txt_filename);
while (std::getline(txt_stream, line))
{
}

http://www.cplusplus.com/reference/ios/ios_base/openmode/
Last edited on
Topic archived. No new replies allowed.