The question is nonsense. A program can ask for as much, or as little, as it needs to, and the amount it actually it gets may be equal to or less than that -- subject to things like interrupts and end-of-file.
If the task is to count characters, then -m should be used. Of course, to count characters correctly, the effective locale must be consistent with the file's contents.
The only extant system I know where the system's character size is anything but 8-bit is Windows CE 3/4. (And perhaps newer.) And even it specifies reads in bytes, not characters.
You're arguing something that hasnt' been asserted. Even if you're 100% correct regarding which systems use which default encoding, it's irrelevant if the task involves counting the number of characters in a file (which may be encoded in an encoding that differs from the system default).
wc -c counts bytes. wc -m counts characters. If you care about characters, use -m . There's really nothing more to say except make sure that the correct encoding is in effect when counting characters.
Not at all. I believe you misunderstood the original post.
You are mistaken.
Your first response in this thread, post #3, indicates that you misinterpreted the use of read in post #1 as a reference to the system call of the same name. The OP's follow up, post #4, indicates that read instead refers to a line.
In that question, "read" refers to a line.
The task is to determine the length of a single line of text by counting letters (presumably all lines are the same length).
You are absolutely correct, but the read syscall is not relevant here.
I did not say that read(2) is not necessary, only that it is irrelevant. What's relevant to correctly counting the number of characters in a line is the correct locale and inspection by a locale-aware interface, such as mbrtowc(3) and friends. Using -m provides the latter.
By the way, none of the OP's posts mention reading a fixed quantity (and none use the word byte). The very solution you were assisting with, head piped into wc, makes it clear that a fixed-size read is not part of the equation.
Thanks for the replies guys..
I have done bit of research & found that wc -m counts characters while wc -c counts the bytes..
Is byte a character in general in this context??? Because both give the same results.