473,406 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Reversing string from one text file to another new text file

#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <algorithm>
#include <fstream>
#include <ios>
#include <iterator>
#include <vector>

int main()
{
//for reading content from readgo.txt file
std::ifstream input_file("E:\\readgo.txt",std::ios_base::binary) ;
//for writing content to revwrite.txt file
std::ofstream output_file("E:\\revwrite.txt",std::ios_base::bina ry);

//input iterator with begining from readgo.txt
std::istreambuf_iterator<char> input_begin(input_file);
std::istreambuf_iterator<char> input_end;

//output iterator that writes to revwrite.txt
std::ostreambuf_iterator<char> output_begin(output_file);

//used for storing collection of character in vector
std::vector<char>
input_data(input_begin,input_end);
//Copies the elements from the readgo.txt & paste in reverse order
std::reverse_copy(input_data.begin(),input_data.en d(),output_begin);
}
Nov 30 '15 #1
0 981

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

Similar topics

5
by: cwbp15 | last post by:
Using Visual Studio C# When I ran the following code: System.IO; private void Button1_Click(object sender, System.EventArgs e) { //FileStream fs = File.Create(Server.MapPath("test.txt"));...
3
by: C# to XML | last post by:
Hi Friends, I am new to csharp , I am using the following code to write into xml file : Just go through the code : fp = File.OpenText(Server.MapPath(".\\upload\\") + "test.txt"); string...
4
by: steele20 | last post by:
I have a problem, Im reading numbers from a text file like this 10 20 3 x1 y1 x2 y2 and so on, x and y are values and theres no limit but will probably not be more than 5 or so.
0
by: singhipst | last post by:
Hi All, I am very new in VB. Can anybody please give me sample source code for serching a perticular string in a text file and its count in some Grid. Description of problem: I will...
5
by: Simon Rigby | last post by:
Hi folks, Apologies if this is not directly relevant but I was struggling to find a group with the appropriate context. So as my problem is in an aspx web site I thought I'd try here first....
8
by: pappu | last post by:
Hello friends, I want to convert .xls file into text file.So can anybody pls help me out. Thxxxxxx, Sachin.
2
by: progvar | last post by:
Hi! can any one help me by providing the method when i open any text file and convert into pdf format. I searched on the net and i got some code but i am not understanding this code and it also...
1
by: agarwalsunitadhn | last post by:
Hi I am developing an application in which i need to convert a text file into a resource file and then serach different resources from the resource file. I want to know how to create the resource...
13
by: madankarmukta | last post by:
Hi all, Is there any way by which I can export the data from the dataset table to the text file or xls file ? Currently I implemented this by itterating through each row of the table and...
1
by: rajeev4983 | last post by:
I have an EDI file whose structure is given below. This file has multiple records, each record contains a header(e.g EDI.DD.0000000001.20130809), then contents (i.e multiple paragraphs of text) and...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.