<br><br><div class="gmail_quote">On Tue, Nov 30, 2010 at 5:22 PM, alexandre bp <span dir="ltr"><<a href="mailto:abalonpe@ulb.ac.be">abalonpe@ulb.ac.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
You are right!<div>sorry I didn't know there were a different mailinglist for pharo.</div><div><br></div></blockquote><div><br>no problem, it was just for you, for me it is the same ;)<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div></div><div>cheers</div><div>alex<br><br><div class="gmail_quote">2010/11/30 Mariano Martinez Peck <span dir="ltr"><<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>></span><div><div>
</div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Alexandre, maybe you will receive more answers if you ask directly in the pharo mailing list instead of seaside, since Files doesn't have anything to do with seaside ;)<br>
<br><a href="http://www.pharo-project.org/community" target="_blank">http://www.pharo-project.org/community</a><br>
<br><div class="gmail_quote"><div>On Mon, Nov 29, 2010 at 10:20 PM, alexandre bp <span dir="ltr"><<a href="mailto:abalonpe@ulb.ac.be" target="_blank">abalonpe@ulb.ac.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Thank you very much for your help.<div>The thing is that, when I first got the exception, I deleted the file manually in the Pharo folder so I'm pretty sure it doesn't exist.</div><div>
Maybe that when I do: "aStream := FileStream newFileNamed:filename" Pharo looks everywhere in my computer than it might find a file named 'test' </div></blockquote></div><div><br>No, that shouldn't happen. What if you do FileDirectory defaul newFileNamed: filename<br>
<br>does it work?<br><br>BTW..did you read Pharo by Example? Because there is a whole chapter explaining Streams and files....I am very bad with them, I always forget how to do trivial things and I need to check there...<br>
<br><a href="http://pharobyexample.org/" target="_blank">http://pharobyexample.org/</a><br><br>Cheers<br><br>Mariano<br> </div><div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>or with a part of it named which is 'test'...but the file was created in the Pharo folder so I assume it must look only there to find a file, no?</div></blockquote></div><div><br>yes<br> </div><div><div></div>
<div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>alex</div><div><br><br><div class="gmail_quote">2010/11/28 Levente Uzonyi <span dir="ltr"><<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>></span><div><div></div><div><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>On Sat, 27 Nov 2010, alexandre bp wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
I'm having trouble with the FileStream....<br>
<br>
I have tried several things:<br>
filename := 'test'.<br>
aStream := StandardFileStream new.<br>
1) aStream := FileStream newFileNamed:filename.<br>
2) aStream := filename asFilename writeStream.<br>
<br>
1) this solution worked one time but when I tried to create other<br>
files with other names (whatever the name) I get an exception:<br>
FileExistsException<br>
2) doesn't work at all. I get an exception as well:<br>
MessageNotUnderstood: ByteString>>asFilename.<br>
</blockquote>
<br></div>
How to use FileStreams?<br>
<br>
existingReadOnlyFile := FileStream readOnlyFileNamed: 'foo'. "raises an exception if the file doesn't exist"<br>
existingReadableAndWriteableFile := FileStream oldFileNamed: 'foo'. "raises an exception if the file doesn't exist"<br>
readableAndWriteableFile := FileStream fileNamed: 'foo'. "automatically creates the file if it doesn't exist"<br>
newReadableAndWriteableFile := FileStream newFileNamed: 'foo'. "raises an exception if the file exists"<br>
newReadableAndWriteableFile := FileStream forceNewFileNamed: 'foo'. "deletes the file if it exists"<br>
<br>
All of these methods have a do: variant. For example:<br>
FileStream readOnlyFileNamed: 'foo' do: [ :file | file contents "This will close the file and return it's contents." ].<br>
<br>
When to use StandardFileStream?<br>
Only when you don't need character encoding or line-end conversion.<div><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
I don't know what to do.... I don't understand why I have the<br>
exception FileExistsException even thought the name I give to filename<br>
is different...<br>
</blockquote>
<br></div>
Are you sure that the file doesn't exist? Some systems (windows and most macs) are case insensitive, so if you have a file named 'TEST', then you also have 'test' and 'Test', etc.<br>
<br>
<br>
Levente<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>
<br>
Thx for your help<br>
<br>
alex<br></div>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br>
</blockquote>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</blockquote></div></div></div><br></div>
<br>_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br></blockquote></div></div></div><br>
<br>_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br></blockquote></div></div></div><br></div>
<br>_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br></blockquote></div><br>