file pointer

hi all:
bankpro again,

i want to open a file and close it after an hour (i.e open and close the file ptr)
In the mean time i will be executing my jobs using the shell (CommandInterpreter).

plz help... :cool:

sleep 3600 < somefile &

this post is in the c programming section, so i am assuming you want a c program to do that, is that right ?
if yes, you still can do it almost in a same way
use the sleep function provided by c.

#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

void openfile_and_sleep(char *filename, unsigned int sleeptime)
{
    FILE *input=fopen(filename,"r");
    if(input==NULL)
    {
          perror("Error opening file");
          exit(EXIT_FAILURE);
    }
    sleep(sleeptime);
    fclose(input);
}

You will have to fork() and then call this function from the child process - if you want the main process to do something else.