how to seek to the start of afile in c++

#include <iostream>
#include <fstream>

int main() {
    std::ifstream file("example.txt", std::ios::in | std::ios::binary);

    if (!file.is_open()) {
        std::cerr << "Failed to open the file." << std::endl;
        return 1;
    }

    file.seekg(0, std::ios::beg); // Seek to the start of the file

    // Perform operations at the start of the file

    file.close(); // Close the file stream

    return 0;
}