Originally Posted by pinniped
1. use 'fgets' if you know the length of the longest line - read in 1 line at a time until you find the second '@' - use 'ftell' to get its file position.
2. use 'fseek' to go to the end of the file and read the position with 'ftell'
3. Select a random number from the '@' to the end of file and read backwards until you find a '\n' - then use fgets again to read the line from that position. Alternatively, after finding the start, just use 'fgets' + 'ftell' until you get to the end of file; use teh info from 'ftell' to make a list of line start positions - then select them at random and use 'fgets' to read them.
I overcame some other obstacles and now ready for this part but need more help please -
I am running the tcsh script in cygwin. The first line of my script is #!/usr/bin/tcsh and I am able to execute it. When I added fopen command to read the content of receptor.mol2 I get an error. The script:
FILE * receptor
receptor = fopen("receptor.mol2","r")
dock.csh: ASCII text, with CRLF line terminators
fopentest.tcsh: a /usr/bin/tcsh\015 script text executable
receptor.mol2: ASCII text
receptor: cannot open `receptor' (No such file or directory)
Badly placed ()'s.
where the first word in each line is a file in the folder.
Can you walk me through the syntax please?