I am trying to write a utility that takes as argument 1 a file name to
write to and as argument 2 takes num as a number of zeros to write a
argument 1. A file of zeros. This is how far I have got. Why would I want a
file of zeros? To mount to a loopback device.
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
if (argc != 3)
{
puts ("usage error");
exit (EXIT_FAILURE);
}
char a = '0';
int b, num;
FILE *fp;
num = atoi (argv[2]);
fp = fopen (argv[1], "wb");
I am thinking that I would need a for loop involved here somewhere. I am
not sure what to put in the body.
Bill
write to and as argument 2 takes num as a number of zeros to write a
argument 1. A file of zeros. This is how far I have got. Why would I want a
file of zeros? To mount to a loopback device.
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
if (argc != 3)
{
puts ("usage error");
exit (EXIT_FAILURE);
}
char a = '0';
int b, num;
FILE *fp;
num = atoi (argv[2]);
fp = fopen (argv[1], "wb");
I am thinking that I would need a for loop involved here somewhere. I am
not sure what to put in the body.
Bill
Comment