$\lim_{n\to \infty}f(nx)=0$ implies $\lim_{x\to \infty}f(x)=0$ Can anyone help me with this problem?

Let $f:[0,\infty)\longrightarrow \mathbb R$ be a continuous function such that for each $x>0$, we have $\lim_{n\to \infty}f(nx)=0$. Then prove that $\lim_{x\to \infty}f(x)=0$.

Our teacher told first to prove Baire's theorem, and then show that this is a consequence of that theorem. I proved Baire's theorem, and I spend a few hours thinking on how Baire's theorem is related to this problem, but I couldn't find anything. I'd really appreciate your help.
 A: You might also be interested in this article by Timothy Gowers, where he describes a thought process of how one might arrive at an elementary proof of this statement (without using the Baire theorem).
A: Fix $\epsilon>0$ and put $F_n:=\left\{x\geq 0,\forall k\geq n, |f(kx)|\leqslant \varepsilon\right\}$. Then for all $n$ $F_n$ is closed since $f$ is continuous and $\bigcup_n F_n=[0,+\infty[$. By Baire's theorem we can find $x_0\geq 0$, $r>0$ and $n_0$ such that $]x_0-r,x_0+r[\subset F_{n_0}$. 
Put $t_0:=n_1x_0$ where $n_1$ is an integer $\geqslant n_0$ and such that $\frac{x_0}{n_1}<r$. Take $x\geq t_0$. Then we can write $x=n_xx_0+\beta$ where $n_x$ is an integer $\geqslant n_1$ and $0\leqslant \beta<x_0$. So 
$$|f(x)|=\left|f(n_xx_0+\beta)\right|=\left|f\left(n_x\left(x_0+\frac{\beta}{n_x}\right)\right)\right|\leqslant \varepsilon$$
since $n_x\geqslant n_1$ and $x_0+\frac{\beta}{n_x}\in ]x_0-r,x_0+r[\subset F_{n_0}$
(this because $\left|\frac{\beta}{n_x}\right|\leqslant \frac{x_0}{n_x}\leqslant \frac{x_0}{n_1}<r$).
So we have shown that given a $\varepsilon>0$, we can find $t_0$ such that for $x\geqslant t_0$, $|f(x)|\leq\varepsilon$.

The result is more easy to establish when $f$ is supposed to be uniformly continuous on $[0,+\infty[$.
