Your $f$ should be $g$. $\cal C$ is the collection of all measurable subsets $S$ of $[a,b]$ such that $\int_S g = 0$. The assumption $\int_a^c g = 0$ says that the interval $(a,c)$ (or equivalently $[a,c]$) is in $S$, but it's easy to see that every interval $(c,d) \subseteq [a,b]$ is in $\cal C$ because $\int_c^d g = \int_a^d g - \int_a^c g$. If $F$ is any closed subset of $[a,b]$, the complement $[a,b] \backslash F$ is an open set, which is the union of at most countably many disjoint intervals $I_n$. Now $\int_{\bigcup_n I_n}\, g = \sum_n \int_{I_n} g = 0$, and $\int_F\, g = \int_a^b g - \int_{[a,b] \backslash F}\, g = 0$. Thus $\cal C$ contains all closed subsets of $[a,b]$.
The next ingredient in the proof is the inner regularity of Lebesgue measure, which implies that any measurable subset $E$ of $[a,b]$ contains a closed set $F$ whose measure $m(F)$ is arbitrarily close to the measure $m(E)$ of $E$: in particular, if $E$ has positive measure, so does $F$. Now, the union of the measurable sets $\{x: g(x) > 1/n \}$ and $\{x: g(x) < -1/n\}$ is $\{x: g(x) \ne 0\}$. If $g$ is not almost everywhere 0, then some of those, say $E = \{x: g(x) > 1/n\}$, has positive measure. So inner regularity says there is a closed subset $F$ of $E$ that has positive measure. But then $\int_F g \ge (1/n) m(F) > 0$, contradicting the fact that $F \in \cal C$.