# Missing number needed to (re)define \hrulefill

The following code works but comes with three errors. Undefined control sequence, missing number, illegal unit of measure. It seems that the redefined \hrulefill is expecting a number to be input but I don't know what or where. Any suggestions would be appreciated.

\documentclass{exam}
\begin{document}
Start with text before filling the rest of the line with a line. \hrulefill
\end{document}

-

\kern expects a length, so you can use

\documentclass{exam}
\begin{document}
Start with text before filling the rest of the line with a line. \hrulefill
\end{document}


or, using the TeX \z@ (as your code suggests you were trying to do),

\documentclass{exam}
\makeatletter
\makeatother
\begin{document}
Start with text before filling the rest of the line with a line. \hrulefill
\end{document}


Instead of redefining \hrulefull, I'd suggest you to define another command:

\documentclass{exam}
\makeatletter

so you can still use the default \hrulefill.
\kern0pt will look for an optional space. Thus \kern0pt␣ or \kern0pt\relax will get a compatible \hrulefill. –  Heiko Oberdiek Sep 17 '13 at 4:40