Suppose $f:\left[0,1\right]\rightarrow R$ is continuous on $\left(0,1\right)$. Prove there is a sequence of step functions $\left\{f_{n}\right\}$ which converge pointwise to $f$ on $\left[0,1\right]$.
John Franks - A (Terse) Introduction to Lebesgue Integration 2009 - 1.5.6 (7), page 13.
But, consider $f=\sin\frac{1}{x}$, with $f=a$ when $x=0$, is continuous on $\left(0,1\right)$. Suppose that, a step function $f_{n}$, is constant on $\left[0,k\right]$, $k<1$. Since, $-1\leq\sin\frac{1}{x}\leq1$ on $\left(0,k\right)$, so $\lim_{n\rightarrow\infty}f_{n}\neq f$
I can't believe this book is wrong. Is my example correct? If it's not, how to prove this problem? Thanks.