A new method is presented for one to obtain the molar heat capacities of diatomic macroscopic gas with a full set of microscopic molecular rovibrational energies. Based on an accurate experimental vibrational energies subset of a diatomic electronic ground state, the full vibrational energies can be obtained by using the variational algebraic method (VAM), the potential energy curves (PECs) will be constructed by the Rydberg-Klein-Rees (RKR) method, the full set of rovibrational energies will be calculated by the LEVEL program, and then the partition functions and the molar heat capacities of macroscopic gas can be calculated with the help of the quantum statistical ensemble theory. Applying the method to the ground state HBr and HCl gases, it is found that the relative errors of the partition functions calculated in the temperature range of 300 ∼ 6000 K are in excellent agreement with those obtained from TIPS database, and the calculated molar heat capacities are closer to the experimental values than those calculated by other methods without considering the energy levels of highly excited quantum states. The present method provides an effective new way for one to obtain the full set of molecular rovibrational energies and the molar heat capacities of macroscopic gas through the microscopic spectral information of a diatomic system.