How can I write a lot of data in the RAM to file fast.

My question is lots of data need to be save , but when I used fwrite() or write() , I found it too slow, maybe 20+M/s. However, the sata harddisk write /read speed up to 100-200M/s. And I 'm not sure the fwrite () or write() function using the DMA mode or PIO mode, how can I solve the problem. Please help me, thank you.
PS:I’m so sorry ,my English is poor ,so I am no sure that the problem is clear or not.

read() and write() are faster then fread()/fwrite().

The SATA read/write speeds you mentioned is probably the wire speed. That’s the speed that data goes through the SATA cable. There are many other constraints. For example, on read, you will get no faster speed then the data passing under the heads. Once the write cache is filled, the same will be true on writes. There are numerous places that overhead can occur. The QNX file system is not known for blazingly fast I/O either. It is however optimized for multi process access.