cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
how could i edit a text file using f str
how could i edit a text file using f stream
Mar 23, 2014 at 8:06am UTC
houda289
(2)
i have a assignment which sayswrite a c++ program that converts each charecter afteer a period '.' to an uppercase charecter heres what i've done and its just reading the file whithout editing
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
int main()
{string fileName="";
ifstream inFile;
cout<<"please enter the file name"<<endl;
cin>>fileName;
inFile.open(fileName);
string words;
string test;
while(!inFile.eof()){
getline( inFile, words, '\0');
inFile>>words;
for(int i=0;i<words.length();i++){
if(words[i]==(int)".")
words[i+1]-32;
}
}
inFile.close();
ofstream outFile;
outFile.open("habal.txt");
outFile<<words;
outFile.close();
}
thanks
Topic archived. No new replies allowed.