[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-users] Input File Manipultaion



Thanks a lot Todd .. Will check out and get back!

----- Original Message ----
From: Todd Tannenbaum <tannenba@xxxxxxxxxxx>
To: Condor-Users Mail List <condor-users@xxxxxxxxxxx>
Sent: Monday, 17 September, 2007 2:44:49 PM
Subject: Re: [Condor-users] Input File Manipultaion

Preethi Chockalingam wrote:
>
> Hi Todd,
>  
>     Let me ask with an example
>  
> C example:
> #include<stdio.h>
> void main()
> {
> int a,b;
> printf("Enter the value of a");
> scanf("%d",&a);
> printf("Enter the value of b");
> scanf("%d",&b);
> }
> Input file has numbers 6 and 7. How will the program read it??

You should not have to change your program at all.  If you have a file,
say it is called "myprogram.input", that contains:
6
7

then in your submit file you give to Condor do
   input = myprogram.input

What then happens is whenever your program would have normally read a
keystroke from the terminal (keyboard), it will instead read a character
from the file myprogram.input.  Your actual program does not know (or
care) that the characters are bytes coming from a file -vs- bytes
originating from keystrokes.

>  
> What will happen if it is a java prog??

Should behave the same as your C program.

> Should i open a file handler and read the contents line by line or will
> Condor read automatically form the file??

You could change your program to open a file and read it line by line,
but by redirecting stdin via "input=" in the submit file, you don't have
to - your program can continue to read "from the keyboard", but when
running via Condor it really will be reading from your input file.

This is the same idea as running your program from the shell prompt like so:
    a.out < myprogram.input
Google for "redirect stdin" or some such for some additional background.

Hope this helps,
Todd
_______________________________________________
Condor-users mailing list
To unsubscribe, send a message to condor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/condor-users

The archives can be found at:
https://lists.cs.wisc.edu/archive/condor-users/



Get the freedom to save as many mails as you wish. Click here to know how.