/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that writes a string
to a file. */ 
#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE *stream;
    char *name;
    int c, i;  
   
    c = 'a';
    if((name = tmpnam(NULL)) == NULL)
        printf("temp file name could not be made. \n");
    /* open file for reading and writing */
    if((stream = fopen(name,"w")) == NULL) { 
        printf("cannot open file\n");
        exit(1);
    }
    for(i =0; i <10; i++) {
        putc(c, stream);
        printf("%c", (char)c);
    }
    printf("\n");
    fclose(stream);
    remove(name);
}
