function



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


.



Relevant Pages

  • Re: [RFC] New kernel-message logging API
    ... return buf; ... static char* put_dec(char *buf, unsigned long long num) ... static int skip_atoi ...
    (Linux-Kernel)
  • Can I save ADODB.Command into a file?
    ... char buf; ... ULONG uread = 0; ... num = file.gcount; ... int main ...
    (microsoft.public.vc.atl)
  • resource_size_t printk whinging
    ... -asmlinkage int vprintk(const char *fmt, ... num = va_arg ...
    (Linux-Kernel)
  • hello-exploit.c
    ... int main(int argc, char *argv) { ... /*The greater the NUM of strlen- NUM, ... void help; ...
    (Bugtraq)
  • Re: Newbie question
    ... license, provide either the license text or at least ... int main ... If you have a good reason to use char, do so, of course. ... Since you have #define NUM, ...
    (comp.lang.c)