I/O OPERATIONS ON CHARACTERS // get() & put()

Home Forums C++ I/O OPERATIONS ON CHARACTERS // get() & put()

This topic contains 0 replies, has 1 voice, and was last updated by  admin 10 months, 4 weeks ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #5247

    admin
    Keymaster

    //I/O OPERATIONS ON CHARACTERS
    // get() & put()
    #include <iostream.h>
    #include <fstream.h>
    #include<string.h>
    int main()
    {
    char string[80];
    cout<<“enter a string \n”; cin>>string;
    int len =strlen(string);
    fstream file;
    file.open(“TEXT”. ios::in | ios::out);
    for (int i=o;i<len;i++)
    file.put(string[i]);
    file .seekg(0);
    char ch;
    while(file)
    {
    file.get(ch);
    cout<<ch;
    }
    return 0;
    }

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.