I see that other answers have given pretty good references to this standard result. But it looks like OP wants a detailed answer with probably more explanation than is available in textbook or Wikipedia. I will try to provide some more details.
Before we can proceed for a proper proof we need to understand few important results (they can be thought of as prerequisites):
1) If $\lim_{x \to a}F(x)$ exists and is positive then $F(x)$ is positive in a certain neighborhood of $a$ (except possibly at $a$). Both the occurrences of the word "positive" can be replaced by "negative".
2) Using result 1) above and definition of a derivative it can be shown that:
2a) if $f'(c) > 0$ then there is a neighborhood $I$ of $c$ such that $f(x) > f(c)$ when $x \in I, x > c$ and $f(x) < f(c)$ when $x \in I, x < c$. In this case we also say that "$f(x)$ is strictly increasing at $c$".
2b) if $f'(c) < 0$ then there is a neighborhood $I$ of $c$ such that $f(x) < f(c)$ when $x \in I, x > c$ and $f(x) > f(c)$ when $x \in I, x < c$. In this case we also say that "$f(x)$ is strictly decreasing at $c$"
3) Using 2a) and 2b) above it can be shown that if $f(x)$ has a local maximum or local minimum at $x = c$ then $f'(c) = 0$.
4) If $f(x)$ is continuous in $[a, b]$ then it attains its maximum and minimum values in $[a, b]$.
Now we can come to the solution of the problem posted by OP. Let $g(x) = f(x) - Cx$. Then it can seen easily that $g(x)$ is differentiable in $(a, b)$ and $g'(x) = f'(x) - C$. Also we have $g'_{+}(a) = f'_{+}(a) - C$ and $g'_{-}(b) = f'_{-}(b) - C$. Since $C$ lies between $f'_{+}(a)$ and $f'_{-}(b)$ it follows that $g'_{+}(a)$ and $g'_{-}(b)$ are non-zero and of opposite signs.
We take the case when $g'_{+}(a) < 0, g'_{-}(b) > 0$. Since $g'_{+}(a) < 0$ it follows that there is a neighborhood $[a, a + h)$ such that $g(x) < g(a)$ for $a < x < a + h$. It means that there are values of $g(x)$ which are less than $g(a)$. Similarly $g'_{-}(b) > 0$ implies that there is a neighborhood $(b - h', b]$ such that $g(x) < g(b)$ for $b - h' < x < b$. Thus there are values of $g(x)$ which are less than $g(b)$. Now $g(x)$ is continuous in $[a, b]$ and hence attains its minimum value at some point $c \in [a, b]$. Clearly by above reasoning $c \neq a, c \neq b$. Hence $c \in (a, b)$ and then $c$ also acts as a local minimum of $g(x)$. Hence $g'(c) = 0$ or $f'(c) = C$.
We can handle the case when $g'_{+}(a) > 0, g'_{-}(b) < 0$ but this time arguing for a maximum of $g$.