No non-trivial clopen sets in $\mathbb{R}$? How to give a direct proof? How to give a direct proof of the following result?

Let $A$ be a subset of $\mathbb{R}$ such that $A$ is both open and closed. Then $A$ is either empty or all of $\mathbb{R}$?

My work: 
If $A$ is not empty, let $u \in A$. Then there is some open interval $(a,b)$ such that $$u \in (a,b) \subset A.$$
Now if $\mathbb{R} - A$ is not empty either, then let $v \in \mathbb{R} - A$. Then there is some open interval $(c,d)$ such that 
$$v \in (c,d) \subset \mathbb{R} - A.$$
Suppose that $u < v$. 
Since $$\emptyset \subset (a,b) \cap (c,d) \subset A \cap (\mathbb{R} - A) = \emptyset,$$
we must have $$(a,b) \cap (c,d) = \emptyset.$$
So we can conlclude that $$b \leq c.$$
But $b \in A$ and $c \in \mathbb{R} - A$. So we must have $$b < c.$$
What next? Can anybody here please help complete the proof from here on?
An edit based on a comment by Marc Paul: 
Let us assume that the set $A$ is a non-trivial clopen set in $\mathbb{R}$. Let us define a function $f \colon \mathbb{R} \to \mathbb{R}$ as follows: 
$$f(x) \colon= \begin{cases} 1 \ \mbox{ for } \ x \in A; \\ 0 \ \mbox{ for } \ x \in \mathbb{R} - A. \end{cases}$$ 
Let $V$ be an open set in the range space $\mathbb{R}$. We show that the inverse image set $f^{-1}(V)$ is open in the domain space $\mathbb{R}$. 
The following cases arise: 
If $0, 1 \in V$, then $f^{-1}(V) = \mathbb{R}$. 
If $0 \in V$ but $1 \not\in V$, then $f^{-1}(V) = \mathbb{R} - A$. 
If $1 \in V$ but $0 \not\in V$, then $f^{-1}(V) = A$. 
And, if $0 \not\in V$ and $1 \not\in V$, then $f^{-1}(V) = \emptyset$. 
Thus, $f^{-1}(V)$ is open in the domain space $\mathbb{R}$. 
Hence the function $f$ is continuous. 
What next? How does this lead to our desired conclusion? 
[Yet another edit, again based on valuable comments from Marc Paul: ]
So if both $A$ and $\mathbb{R} - A$ were non-empty, then let's suppose $a \in A$ and $b \in \mathbb{R} - A$, and we can assume without any loss of generality that $a < b$. 
Then $f(a) = 1$ and $f(b) = 0$. So by the intermediate value theorem there is a real number $c \in (a,b)$ such that $f(c) = 1/2$, which is a contradiction because the image set of $f$ does not contain $1/2$. 
 A: Assume for a contradiction that $A$ is a clopen subset of $\mathbb R,\ $ $\emptyset\ne A\ne\mathbb R.$ Choose $a\in A$ and $b\in\mathbb R\setminus A.$ Without loss of generality, we may assume that $a\lt b.$
Let $c=\sup(A\cap[a,b]).$ Since $A$ is closed we have $c\in A,$ and so $a\le c\lt b.$ Now $c\in A$ and $(c,b]\subseteq\mathbb R\setminus A,$ contradicting the assumption that $A$ is open.
A: We assume by contraddiction that $A$ is a non trivial clopen set.
Let $u \in A$ and consider the family 
\begin{equation}
\mathcal{F} = \{ \ I \ : \  u \in I  \ \text{ and } I \subset A \text{ is an open interval }\}.
\end{equation}
The union  $J = \bigcup\mathcal{F}$ is still an open interval contained in $A$. So $J = (a, b)$ for some $a < u < b$, and $a$ or $b$ must be a real number (not plus or minus infinity). Now assume w.l.o.g. $b \in \mathbb{R}$. Then $b \in \mathbb{R} \setminus A$. Since $\mathbb{R} \setminus A$ is open, there must be  an open interval $B$ contained in $\mathbb{R} \setminus A$ containing $b$. But then $B \cap A \ne \emptyset$. And this is a contraddiction.
