Is there an upper limit on .txt file size?

前端 未结 11 2360
礼貌的吻别
礼貌的吻别 2021-02-18 14:03

As a Christmas gift I have written a small program in Java to calculate primes. My intention was to leave it on all night, calculating the next prime and writing it to a .txt fi

相关标签:
11条回答
  • 2021-02-18 14:17

    What about just creating one file for each prime number and then use the filename to display the number?

    0 讨论(0)
  • 2021-02-18 14:22

    Somehow I doubt that when having your program run overnight, that the filesize will be a problem, considering that it will take longer to find primes as numbers get bigger. Just make sure you clean up or you might eat up all your RAM.

    To answer your question: Theoretically, the filesystem restricts file size. However, a lot of text editors crash (vim does not) when loading big files (> 100 MB), because they try to fit it in one buffer.

    To sum up, consider splitting up your files into chunks the weakest link (text editors) can handle.

    0 讨论(0)
  • 2021-02-18 14:26

    Only as to the size of the place you're storing the text file on disk.

    And, if you're not writing it all right away, your memory + virtual memory.

    0 讨论(0)
  • 2021-02-18 14:27

    How about saving some CPU cycles and just downloading a pre-computed list of primes? Or is it more "the thought that counts"? :)

    0 讨论(0)
  • 2021-02-18 14:28

    You might consider tracking the number of bytes you write to each file and switching to a new one after some number of bytes. You might also provide a viewer for your files so your friend can see his gift more easily. :)

    0 讨论(0)
提交回复
热议问题