* questions about system function: mmap / fwrite
@ 2005-05-20 9:14 sylvanino b
2005-05-20 9:35 ` Helge Hafting
0 siblings, 1 reply; 2+ messages in thread
From: sylvanino b @ 2005-05-20 9:14 UTC (permalink / raw)
To: linux-kernel
Hello,
I have a question about ways of accessing a file.
I know it is possible to use: fseek + fwrite/fread to access a file.
and It is also possible to map file in memory with "mmap" function,
and access it by adressing memory.
Currently I use the frame buffer of mobile phones with mmap function.
For my understanding, I would like to know what is the difference
between using fseek+fwrite compared to mmap style.
Dont hesitate to be precise or to use technical terms.
Thanks you,
Sylvanino
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: questions about system function: mmap / fwrite
2005-05-20 9:14 questions about system function: mmap / fwrite sylvanino b
@ 2005-05-20 9:35 ` Helge Hafting
0 siblings, 0 replies; 2+ messages in thread
From: Helge Hafting @ 2005-05-20 9:35 UTC (permalink / raw)
To: sylvanino b; +Cc: linux-kernel
sylvanino b wrote:
>Hello,
>
>I have a question about ways of accessing a file.
>
>I know it is possible to use: fseek + fwrite/fread to access a file.
>and It is also possible to map file in memory with "mmap" function,
>and access it by adressing memory.
>
>Currently I use the frame buffer of mobile phones with mmap function.
>For my understanding, I would like to know what is the difference
>between using fseek+fwrite compared to mmap style.
>Dont hesitate to be precise or to use technical terms.
>
>Thanks you,
>
>
There may be subtle performance differences, but I'd say the most
important here is to use the API that best suits the problem at hand.
fwrite/fread is sequential in nature, useful when you want to read/write
large contigous chunks of data, and when the notion of a "current position"
in the file is useful.
mmap is nice when you find it useful to access the file as a random-access
array of bytes. mmap style access seems to be the best fit for a
framebuffer.
Helge Hafting
Helge Hafting
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-05-20 9:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-20 9:14 questions about system function: mmap / fwrite sylvanino b
2005-05-20 9:35 ` Helge Hafting
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome