Take Full Control on Files

This is a discussion on Take Full Control on Files within the C++ Programming forums, part of the General Programming Boards category; Hi there, i have writing program which takes file name(full path) and do some modification on these file. Assuming we ...

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    2

    Take Full Control on Files

    Hi there,

    i have writing program which takes file name(full path) and do some modification on these file.

    Assuming we have a file that ready to work.
    file.txt:
    name id age
    name id age
    name id age
    name id age

    if i wanna change the id to specific string what function should i use?


    Code:
    #include <iostream>
    #include <fstream>
    #include <string>
    using namespace std;
    
    int main(){
        ifstream file("file.txt");
        string buffer;
    
        
        getline(file, buffer);
        /*
        
            Here i will change buffer's content to do( modification )
        */
        cout<<buffer<<endl; // print out our new data
        file.close();
        return 0;
    }

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    2,760
    Look at the stringstream functions to help process the individual elements of your string.

    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. full size of the window, full screen mode
    By nerio in forum C Programming
    Replies: 4
    Last Post: 07-20-2011, 05:25 PM
  2. geting full path of files and folders (boost::filesystem)
    By umen242 in forum C++ Programming
    Replies: 2
    Last Post: 05-18-2008, 11:37 PM
  3. ATL Control Full Object Model
    By 7thSeeker in forum C++ Programming
    Replies: 6
    Last Post: 05-07-2004, 12:13 PM
  4. Full?
    By Shakespeare in forum C++ Programming
    Replies: 2
    Last Post: 03-02-2002, 10:04 AM
  5. Full control of parallel port?
    By The V. in forum Windows Programming
    Replies: 1
    Last Post: 10-28-2001, 02:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21