1. open() : Files that don't exist
- Posted by Alex Chamberlain <alex.chamberlain at tiscali.co.uk> Dec 30, 2005
- 455 views
- Last edited Dec 31, 2005
Why does }}} <eucode>open("debug.txt", "w")</eucode> {{{ create a file called "DEBUG.TXT"? Is there a way to get around this? Thanks, Alex
2. Re: open() : Files that don't exist
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Dec 30, 2005
- 439 views
- Last edited Dec 31, 2005
Alex Chamberlain wrote: > > Why does }}} <eucode>open("debug.txt", "w")</eucode> {{{ create a file called > "DEBUG.TXT"? > Is there a way to get around this? I hope not. What would you expect to happen when attempting to write a file? Perhaps you want to open with "u"? Or maybe you should check to see if it's already in existence. But the behavior you quote is the proper and expected. Matt Lewis
3. Re: open() : Files that don't exist
- Posted by Alex Chamberlain <alex.chamberlain at tiscali.co.uk> Dec 30, 2005
- 443 views
- Last edited Dec 31, 2005
Matt Lewis wrote: > > Alex Chamberlain wrote: > > > > Why does }}} <eucode>open("debug.txt", "w")</eucode> {{{ create a file called > > "DEBUG.TXT"? > > Is there a way to get around this? > > I hope not. What would you expect to happen when attempting to write a > file? Perhaps you want to open with "u"? Or maybe you should check to see > if it's already in existence. But the behavior you quote is the proper and > expected. > > Matt Lewis Basically, the file is not expected to exist - but I expect that call to create "debug.txt" not "DEBUG.TXT"! Minor - I no. Alex
4. Re: open() : Files that don't exist
- Posted by Vincent <darkvincentdude at yahoo.com> Dec 30, 2005
- 473 views
- Last edited Dec 31, 2005
Alex Chamberlain wrote: > > Matt Lewis wrote: > > > > Alex Chamberlain wrote: > > > > > > Why does }}} <eucode>open("debug.txt", "w")</eucode> {{{ create a file called > > > "DEBUG.TXT"? > > > Is there a way to get around this? > > > > I hope not. What would you expect to happen when attempting to write a > > file? Perhaps you want to open with "u"? Or maybe you should check to see > > if it's already in existence. But the behavior you quote is the proper and > > expected. > > > > Matt Lewis > > > Basically, the file is not expected to exist - but I expect that call to > create > "debug.txt" not "DEBUG.TXT"! Minor - I no. > > Alex Thats interesting... it will have capital letters when created with a DOS (EX), but lowercase with Windows (EXW). Regards, Vincent
5. Re: open() : Files that don't exist
- Posted by don cole <doncole at pacbell.net> Dec 31, 2005
- 456 views
Alex Chamberlain wrote: > > Why does }}} <eucode>open("debug.txt", "w")</eucode> {{{ create a file called > "DEBUG.TXT"? > Is there a way to get around this? > > Thanks, > Alex global function exist(sequence fileOrFolder) object x x=dir(fileOrFolder) if atom(x) then return 0 else return 1 end if end function if exist("debug.txt") then open("debug.txt", "w") else --do nothing end if Don Cole A Bug is an un-documented feature. A Feature is a documented Bug.
6. Re: open() : Files that don't exist
- Posted by Ryan W. Johnson <ryanj at fluidae.com> Dec 31, 2005
- 457 views
don cole wrote: > > Alex Chamberlain wrote: > > > > Why does }}} <eucode>open("debug.txt", "w")</eucode> {{{ create a file called > > "DEBUG.TXT"? > > Is there a way to get around this? > > > > Thanks, > > Alex > > global function exist(sequence fileOrFolder) > object x > x=dir(fileOrFolder) > if atom(x) then > return 0 > else > return 1 > end if > end function > > if exist("debug.txt") then > open("debug.txt", "w") > else > --do nothing > end if > > Don Cole You can use open("debug.txt", "r") to see whether or not the file exists. It will return -1 if it doesn't exist. About the ALL CAPS filename, i believe that is because it is using the DOS file formate. The reference manual says: "DOS32: When running under Windows 95 or later, you can open any existing file that has a long file or directory name in its path (i.e. greater than the standard DOS 8.3 format) using any open mode - read, write etc. However, if you try to create a new file (open with "w" or "a" and the file does not already exist) then the name will be truncated if necessary to an 8.3 style name. We hope to support creation of new long-filename files in a future release." To create a file with a long filename, maybe you could try somehting like this:
fn = open("debug.txt", "w") close(fn) system("rename DEBUG.TXT debug.txt", 2) fn = open("debug.txt", "w")
Just an idea. I can't test this right now, because I switched to linux! ~Ryan W. Johnson Fluid Application Environment http://www.fluidae.com/ [cool quote here, if i ever think of one...]
7. Re: open() : Files that don't exist
- Posted by Brian Broker <brian_broker at yahoo.com> Jan 01, 2006
- 451 views
Vincent wrote: > > Alex Chamberlain wrote: > > > > Matt Lewis wrote: > > > > > > Alex Chamberlain wrote: > > > > > > > > Why does }}} <eucode>open("debug.txt", "w")</eucode> {{{ create a file called > > > > "DEBUG.TXT"? > > > > Is there a way to get around this? > > > > > > I hope not. What would you expect to happen when attempting to write a > > > file? Perhaps you want to open with "u"? Or maybe you should check to > > > see > > > if it's already in existence. But the behavior you quote is the proper > > > and > > > expected. > > > > > > Matt Lewis > > > > > > Basically, the file is not expected to exist - but I expect that call to > > create > > "debug.txt" not "DEBUG.TXT"! Minor - I no. > > > > Alex > > Thats interesting... it will have capital letters when created with a DOS > (EX), > but lowercase with Windows (EXW). > > > Regards, > Vincent how is that interesting? because it doesn't matter? curious, have you ever programmed before Windows existed? early OS's, including DOS, referenced all files with UPPER-CASE names in my brief experience with them. I suppose that's why. It's probably based on the fact that programming with case-sensitive punch-cards would kill too many trees (not to mention the issues with hanging chads). -- Brian
8. Re: open() : Files that don't exist
- Posted by Brian Broker <brian_broker at yahoo.com> Jan 01, 2006
- 437 views
I wrote: > > how is that interesting? because it doesn't matter? > > curious, have you ever programmed before Windows existed? early OS's, > including > DOS, referenced all files with UPPER-CASE names in my brief experience with > them. I suppose that's why. > > It's probably based on the fact that programming with case-sensitive > punch-cards > would kill too many trees (not to mention the issues with hanging chads). > > -- Brian I'll apologize early for my sarcastic reply (just my nature)... I could have just as easily stated that DOS is based on 8-bit systems that had no room for lower-case characters. No hard feelings intended :) -- Brian
9. Re: open() : Files that don't exist
- Posted by Vincent <darkvincentdude at yahoo.com> Jan 01, 2006
- 443 views
Brian Broker wrote: > > I wrote: > > > > how is that interesting? because it doesn't matter? > > > > curious, have you ever programmed before Windows existed? early OS's, > > including > > DOS, referenced all files with UPPER-CASE names in my brief experience with > > them. I suppose that's why. > > > > It's probably based on the fact that programming with case-sensitive > > punch-cards > > would kill too many trees (not to mention the issues with hanging chads). > > > > -- Brian > > I'll apologize early for my sarcastic reply (just my nature)... I could have > just as easily stated that DOS is based on 8-bit systems that had no room for > lower-case characters. > > No hard feelings intended :) > -- Brian Hi Brian, I've only been programming for about four years now. I haven't noticed any case differences before, thats why I found it interesting. Thanks for the clarification. Regards, Vincent