A measurement of the inclusive cross section of charged pions at very high transverse momenta