Search:

Type: Posts; User: Ducky

Search: Search took 0.03 seconds.

  1. Replies
    13
    Views
    12,302

    Thanks but getline() sets bits too so you still...

    Thanks but getline() sets bits too so you still need to clear it.

    "A call to this function may set any of the internal state flags of is if:"



    flag
    error
  2. Replies
    13
    Views
    12,302

    Ok, thanks for the explanation. I understand now...

    Ok, thanks for the explanation.
    I understand now that there is this new concept of "error control state condition" with fstream that doesnt exist with fopen() and CreateFile().
    Apparently it works...
  3. Replies
    13
    Views
    12,302

    Well you can do it with fopen() and Win32 API...

    Well you can do it with fopen() and Win32 API CreateFile() so it's definitely a miss from Mr Bjarne Stroustrup.

    Ah, but I so wanted to use C++... ;-)
  4. Replies
    13
    Views
    12,302

    Yeah, but you changed the code, you closed it and...

    Yeah, but you changed the code, you closed it and reopened it again.
    I want it to be opened in read & write mode and stay open and get the size from time to time.

    We can't do that in C++ ?
  5. Replies
    13
    Views
    12,302

    Ah, thank you. But even if I change it to seekp...

    Ah, thank you.
    But even if I change it to seekp and tellp it returns -1.
    Apparently I do both so how to get the size of the file?
  6. Replies
    13
    Views
    12,302

    tellg() returning -1

    tellg() won't return the size of the file, it returns -1.
    What is the reason for it?


    #include <string>
    #include <iostream>
    #include <fstream>
    using namespace std;

    fstream file;
Results 1 to 6 of 6