Creating a Random file of fixed size

Posted In: C/C++ Beginner
  • Profile photo of willy
    willy on: June 30, 2016 at 6:06 pm #322

    I am interested in creating a fixed size file (~25M) with random data. I am currently considering copying data from /dev/urandom into my file.

    I am familiar with the following method of copying a file (first seen in a @JLBorges post). I love the efficiency and the fact that no intermediate buffer needs to be created.

    How can I modify this code to only copy X bytes into the new file?

    Is there a better way to do what I’m trying to do?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Skip to toolbar