<div dir="ltr"><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">I've just finished reading a very spirited debate on the merits of streaming versus reading in an entire file. I'm convinced that both are ideal depending on the situation. Thank you for the responses I received on my original post. I had tried previously on StackOverflow, having joined just for that purpose, but found myself censured and 'put on hold' for asking a poor question, so I certainly enjoy and appreciate your guy's help and support. Yesterday I discovered what I consider to be an elegant solution (because of it's simplicity and that I comprehend the code) on the sample code of the IBM BlueMix playground website. I include it here in only slightly modified form. They didn't have a 'create file' version, but I can work on trying to come up with that when I get a chance. (Or, any of you can suggest that reverse version). Here it is... (I did test it, and it works)</p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"></p><div style="font-size:12.8px">/* Opens a file and prints it to the</div><div style="font-size:12.8px"> console. Shows how file input can be done in swift.</div><div style="font-size:12.8px"> From IBM BlueMix Swift Playground sample code selections.</div><div style="font-size:12.8px">*/</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)</div><div style="font-size:12.8px"> import Darwin</div><div style="font-size:12.8px">#else</div><div style="font-size:12.8px"> import Glibc</div><div style="font-size:12.8px">#endif</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">let stream = fopen("Resources/sampleIn.txt", "r")</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">var s = ""</div><div style="font-size:12.8px">while (true) {</div><div style="font-size:12.8px"> let c = fgetc(stream)</div><div style="font-size:12.8px"> if c == -1 {</div><div style="font-size:12.8px"> break</div><div style="font-size:12.8px"> }</div><div style="font-size:12.8px"> s = String(Character(UnicodeScalar(UInt32(c))))</div><div style="font-size:12.8px"> print(s, terminator:"")</div><div style="font-size:12.8px"> </div><div style="font-size:12.8px">}</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thanks!</div><div style="font-size:12.8px">John</div><div class="" style="margin:2px 0px 0px;font-size:12.8px"><div id=":lx" class="" tabindex="0"><img class="" src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif" style=""></div><div><br></div></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">John Myers<div>Mathematics and Computer Science Teacher</div><div>Math Department Chair</div><div>Shawano Community High School</div><div>220 County Road B</div><div>Shawano, WI 54166</div><div>------------------------------------------------------------------</div><div><a href="mailto:myersj@shawanoschools.com" target="_blank">myersj@shawanoschools.com</a></div><div>(715) 526-2175 ext 2114</div></div></div>
</div>