Suppose $C$ is a smooth projective curve over $k$, and let $p$ be a rational point. Using Riemann-Roch, it is easy to show that there exists a rational function that is regular everywhere except at $p$. I want to use this fact to show that $C\setminus p$ is affine, but I am not sure where to go.
I know there are a couple of proofs showing $C\setminus p$ is affine using other methods, but I want to show it using the existence of such rational function. Thanks in advance.