function
- From: "Bill Cunningham" <nospam@xxxxxxxxx>
- Date: Sat, 31 May 2008 14:47:21 GMT
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
.
- Follow-Ups:
- Re: function
- From: Joachim Schmitz
- Re: function
- Prev by Date: Re: malloc()/realloc() - have I got this right?
- Next by Date: Re: printing error messages
- Previous by thread: How to print an array of char backward.
- Next by thread: Re: function
- Index(es):
Relevant Pages
|