How to read & write certain characters from a File ?

How to read some characters from file, I know we can move a pointer to some position using seekg() & seekp() function, get current position of the pointer through tellg() & tellp() functions. By moving the pointer to appropriate position using seekg(), we can read the whole line using getline() function. But is there any function which read certain characters from the current position of the pointer and write certain characters from current position of the pointer.
But is there any function which read certain characters from the current position of the pointer and write certain characters from current position of the pointer.

Yes, select what you need:
Unformatted:
  Input:
    get()
    getline()
    read()
  Output:
    put()
    write()
Formatted:
  Input:
    operator>>()
  Output:
    operator<<()
@MiiNiPaa, I ddin't get it. Can you please give me some example.
All input/output operation work from current read/write pointer position.

If you want to know how specific functions work, use reference:
http://en.cppreference.com/w/cpp/io/basic_iostream
http://www.cplusplus.com/reference/istream/iostream/

Example: reading 10 bytes from a file
1
2
3
char buffer[20] = { 0 };
std::istream inp("input");
inp.read(buffer, 10);
Topic archived. No new replies allowed.