long FileSize(FILE* f)
{
    if(f)
    {
        long size;
        long initpos = ftell(f);
        fseek(f,0,SEEK_END);
        size = ftell(f); //Get End Position Which
        fseek(f,initpos,SEEK_SET); //Go Back To Initial Position
        return size;
    }

    return 0;
}

Only 183 characters in text file but reports 197. Reason for this?

I was stupid. Reading a Text file doesn't give you the 0 string ender. Also the method that counted the characters doesn't count '\r' and '\n' characters.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.