Ill show you how in C# it should give you a start to eiether write it in c or move to c#
<FONT color=#808080 size=2>
///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2><summary>
</FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> This function creates a garbage file
</FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2></summary>
</FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2><param name="size"></FONT><FONT color=#008000 size=2>size of the file to be created</FONT><FONT color=#808080 size=2></param>
</FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2><param name="filename"></FONT><FONT color=#008000 size=2>the name of the file to be created</FONT><FONT color=#808080 size=2></param>
</FONT><FONT color=#808080 size=2>///</FONT><FONT color=#008000 size=2> </FONT><FONT color=#808080 size=2><returns></FONT><FONT color=#008000 size=2>if the file creation worked</FONT><FONT color=#808080 size=2></returns></FONT><FONT size=2>
</FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>bool</FONT><FONT size=2> createFile(</FONT><FONT color=#0000ff size=2>uint</FONT><FONT size=2> size, </FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> filename)
{
</FONT><FONT color=#0000ff size=2>
try
</FONT><FONT size=2>{
Byte[] random = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> Byte[100000];
Random randgen = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> Random();
Stream outputStream = File.OpenWrite(@filename);
</FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2>(outputStream == </FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2>)
</FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>false</FONT><FONT size=2>);
</FONT><FONT color=#0000ff size=2>uint</FONT><FONT size=2> loop = size / 100000;
</FONT><FONT color=#0000ff size=2>uint</FONT><FONT size=2> modulo = size % 100000;
Byte[] extra = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> Byte[modulo];
randgen.NextBytes(extra);
</FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> i = 0; i < loop; i++)
{
randgen.NextBytes(random);
outputStream.Write(random,0,random.Length);
}
outputStream.Write(extra,0,extra.Length);
outputStream.Close();
</FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>true</FONT><FONT size=2>);
}
</FONT><FONT color=#0000ff size=2>catch</FONT><FONT size=2>(Exception e)
{
</FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2>(e != </FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2>)
</FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>false</FONT><FONT size=2>);
}
</FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>false</FONT><FONT size=2>);
}
the class you would use in c++ is ofstream
have fun</FONT>