As mentioned previously, one may not eat prior to praying Shaharit (except for certain drinks and circumstances), but this prohibition only takes effect at Alot Hashahar. The Shulhan Aruch (O.H. 89:5) says that one may eat in the middle of the night but that one should stop as of Alot Hashahar.
Nonetheless, the Zohar (Parashat Vayakhel) says that eating before Shaharit, even if it is done before Alot Hashahar, is akin to sorcery. Based on this, the HIDA (Birke Yosef, § 89) rules that after sleeping one should not eat prior to praying, no matter the time. The Kaf HaHaim (K.H., O.H. 89:28) says that one should not even drink prior to praying. The Mishna Berura (M.B., O.H. 89:28) and the Ben Ish Hai (Parashat Nitzavim), however, are lenient and say that drinking is permitted, even according to the Zohar. Rabbi Ben Zion Abba Shaul (Or Lezion, vol. II, ch. 7, § 8), says that one should be strict and not eat in the middle of the night prior to praying, unless one feels ill.
Nevertheless, Rabbi Ovadia Yosef (Yabia Omer, vol. V, § 22:5) writes that, according to the Gemara, there is no prohibition of eating before Alot Hashahar. Indeed, he points out that many are lenient when it comes to eating while reciting Bakashot before dawn. Furthermore, Rabbi Shalom Messas often cites the Radbaz (Shu’t HaRadbaz ), who says that when there is a disagreement between Kabbalah and a non-Kabbalistic Talmud Bavli, the Halacha follows the Talmud Bavli. Rabbi Ovadia Yosef (Hazon Ovadia, Ta’aniot, pg. 10) thus rules that one may eat before Alot Hashahar.
Regarding a fast which begins at Alot Hashahar, one may wake up before this time in order to eat. It is necessary for one to stipulate before going to sleep that if one wakes up prior to Alot Hashahar, one will not accept the fast at that time and that one could eat. One need not make a stipulation if one wishes to drink before the fast.
Summary: One may eat before Alot Hashahar. One a fast day, one should stipulate that if one wakes up before Alot Hashahar, one will not yet accept the fast and thus be able to eat.