Fragmentation functions for charged particles in Z -> qq(bar) events have been measured for bottom (b), charm (c) and light (uds) quarks as well as for all flavours together. The results are based on data recorded between 1990 and 1995 using the OPAL detector at LEP. Event samples with different flavour compositions were formed using reconstructed D* mesons and secondary vertices. The \xi_p = ln(1/x_E) distributions and the position of their maxima \xi_max are also presented separately for uds, c and b quark events. The fragmentation function for b quarks is significantly softer than for uds quarks.