Re: Creating file of size x

2005-06-06 Thread Grant Edwards
On 2005-06-06, Jan Danielsson <[EMAIL PROTECTED]> wrote: >>>The problem is that the design I'm working on won't guarantee >>>what order the blocks will be returned in -- so I need to be >>>able to seek to block n's location and write the ckeck block. >> >> Exactly. And precisely how did that fai

Re: Creating file of size x

2005-06-06 Thread Andrew Dalke
Jan Danielsson wrote: >Is there any way to create a file with a specified size? Besides the simple def make_empty_file(filename, size): f = open(filename, "wb") f.write("\0" * size) f.close() ? If the file is large, try (after testing and fixing any bugs): def make_empty_file(filenam

Re: Creating file of size x

2005-06-06 Thread Jan Danielsson
Grant Edwards wrote: Is there any way to create a file with a specified size? >>> >>>What do you want to put in the file? Once you've answered that >>>question, the solution should present itself. >> >>Check blocks from an FEC-encoder (Freenet, more specifically). >> >> The problem is tha

Re: Creating file of size x

2005-06-06 Thread Grant Edwards
On 2005-06-06, Jan Danielsson <[EMAIL PROTECTED]> wrote: > Erik Max Francis wrote: >>>Is there any way to create a file with a specified size? >> >> What do you want to put in the file? Once you've answered that >> question, the solution should present itself. > > Check blocks from an FEC-enc

Re: Creating file of size x

2005-06-06 Thread Grant Edwards
On 2005-06-06, Jan Danielsson <[EMAIL PROTECTED]> wrote: >Is there any way to create a file with a specified size? Sure: 1) Open a new file for writing. 2) Seek to "specified size"-1. 3) Write one byte. -- Grant Edwards grante Yow! I just put lots of

Re: Creating file of size x

2005-06-06 Thread Ivan Shevanski
http://python.org/doc/2.4.1/modindex.html this is the global module index. I'd keep it handy to search through since it has some of the most useful stuff every intented! =D Try looking through here to help. . .That's the best I can think of. -Ivan _

Re: Creating file of size x

2005-06-06 Thread Ivan Shevanski
What version of python do you use? I'll send you the module library. . .(sorry for double message) -Ivan _ FREE pop-up blocking with the new MSN Toolbar – get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

Re: Creating file of size x

2005-06-06 Thread Jan Danielsson
Erik Max Francis wrote: >>Is there any way to create a file with a specified size? > > What do you want to put in the file? Once you've answered that > question, the solution should present itself. Check blocks from an FEC-encoder (Freenet, more specifically). The problem is that the des

Re: Creating file of size x

2005-06-06 Thread Ivan Shevanski
> > Can you elaborate more? Just any file? > >Yes -- a binary file. > >The file will contain check blocks for another file. The problem is >that the order of the received check blocks is not specified, so I need >to be able seek to the block's position in the file, and then just write >the blo

Re: Creating file of size x

2005-06-06 Thread Erik Max Francis
Jan Danielsson wrote: >Is there any way to create a file with a specified size? What do you want to put in the file? Once you've answered that question, the solution should present itself. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N