File: prepare_file.c

package info (click to toggle)
ruby-tioga 1.19.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,812 kB
  • sloc: ansic: 39,883; ruby: 17,312; sh: 79; makefile: 32
file content (31 lines) | stat: -rw-r--r-- 1,106 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* 
   prepare_file.c: prepare a tmp.dat file with a given number of data lines

   Copyright 2007 by Vincent Fourmond

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Library Public License as published
   by the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Library General Public License for more details.
   
   You should have received a copy of the GNU Library General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
*/

#include <stdlib.h>
#include <stdio.h>

int main(int argc, char * argv[])
{
  int i, imax = atoi(argv[1]);
  FILE * tmp = fopen("tmp.dat", "w");
  for(i = 0; i < imax; i++) 
    fprintf(tmp, "%g\t%g\n", drand48(), drand48());
  fclose(tmp);
}