A fully instrumented slice of the ATLAS detector was exposed to test beams from the SPS (Super Proton Synchrotron) at CERN in 2004. In this paper, the results of the measurements of the response of the barrel calorimeter to hadrons with energies in the range 20 to 350 GeV and beam impact points and angles corresponding to pseudorapidity values in the range 0.2-0.65 are reported. The results are compared to the predictions of a simulation program using the Geant 4 toolkit