| Author |
Message |
mblangy
Guest
|
Posted:
Thu Dec 23, 2004 11:36 pm Post subject:
Read-Line comand not working |
|
|
I have identical lisp routines on two different machines - one works and the other does not. The READ-LINE command is returning nil where there is text...I am stumped.
|
|
| Back to top |
|
 |
T.Willey
Guest
|
Posted:
Thu Dec 23, 2004 11:39 pm Post subject:
Re: Read-Line comand not working |
|
|
Is it finding the file on both machines?
Maybe posting the code will help, and the locations of both text files per each computer.
Tim |
|
| Back to top |
|
 |
mblangy
Guest
|
Posted:
Thu Dec 23, 2004 11:45 pm Post subject:
Re: Read-Line comand not working |
|
|
The source files are on the desktop in both cases. Excerpt from code:
(setq sf (open "sec.mpr" "r"))
(repeat 5 (read-line sf))
(setq minx (substr (read-line sf) 26))
It crashes when it gets to the substr command.
|
|
| Back to top |
|
 |
T.Willey
Guest
|
Posted:
Thu Dec 23, 2004 11:48 pm Post subject:
Re: Read-Line comand not working |
|
|
From the computer that doesn't work do a
(findfile "sec.mpr")
and see what it returns.
Tim |
|
| Back to top |
|
 |
mblangy
Guest
|
Posted:
Thu Dec 23, 2004 11:52 pm Post subject:
Re: Read-Line comand not working |
|
|
| The file that it should be reading is on the desktop. I have many more of these files in other directories as I have been using this code without problem for some time now which is what really drives me crazy. |
|
| Back to top |
|
 |
T.Willey
Guest
|
Posted:
Thu Dec 23, 2004 11:55 pm Post subject:
Re: Read-Line comand not working |
|
|
Try hard coding the path to the desktop then, and see it that works. Only thing I can think of is that it's not finding the right file so there is nothing to read.
Tim |
|
| Back to top |
|
 |
mblangy
Guest
|
Posted:
Fri Dec 24, 2004 12:03 am Post subject:
Re: Read-Line comand not working |
|
|
This is like a bad dream. Here is the new code:
(setq sf (open "C:\Documents and Settings\Administrator\Desktop\sec.mpr" "r"))
(repeat 5 (read-line sf))
(setq minx (substr (read-line sf) 26))
Here are the contents of C:\Documents and Settings\Administrator\Desktop\sec.mpr:
---------------- REGIONS ----------------
Area: 0.8421
Perimeter: 11.9980
Bounding box: X: 73.5967 -- 75.5087
Y: 136.7406 -- 140.0526
Centroid: X: 74.8405
Y: 138.2646
Moments of inertia: X: 16098.9422
Y: 4716.7731
Product of inertia: XY: 8713.8909
Radii of gyration: X: 138.2678
Y: 74.8419
Principal moments and X-Y directions about centroid:
I: 0.1220 along [0.2807 0.9598]
J: 0.8014 along [-0.9598 0.2807]
??????????????????? Thanks anyhow. |
|
| Back to top |
|
 |
T.Willey
Guest
|
Posted:
Fri Dec 24, 2004 12:09 am Post subject:
Re: Read-Line comand not working |
|
|
I cut/pasted what you had into a text file on my desktop, selected that file with getfiled. Your code seemed to work, but minx was set to "". Sorry can't duplicate your problem here.
Tim |
|
| Back to top |
|
 |
mblangy
Guest
|
Posted:
Fri Dec 24, 2004 12:42 am Post subject:
Re: Read-Line comand not working |
|
|
| I modified the code to include all file extensions in file names and it seems to run fine now. |
|
| Back to top |
|
 |
mblangy
Guest
|
Posted:
Fri Dec 24, 2004 12:42 am Post subject:
Re: Read-Line comand not working |
|
|
| Thanks and happy holidays. |
|
| Back to top |
|
 |
T.Willey
Guest
|
Posted:
Fri Dec 24, 2004 12:47 am Post subject:
Re: Read-Line comand not working |
|
|
I don't know what I did, but I'm glad you got it to work for you.
Happy Holidays.
Tim |
|
| Back to top |
|
 |
LUCAS
Guest
|
Posted:
Fri Dec 24, 2004 12:06 pm Post subject:
Re: Read-Line comand not working |
|
|
;;You must waiting!!
(defun WAIT (SECONDS / STOP)
;;
;; Posted by Tony Tanzillo
;; Creates a pause in your program flow
;; This function provides for much finer
;; increments in time then the command DELAY
;;
(setq STOP (+ (getvar "DATE") (/ SECONDS 86400.0)))
(while (> STOP (getvar "DATE"))
(princ)
)
)
(while (or (= (setq FILE (findfile "sec.mpr")) NIL)
(progn (setq FIB (open FILE "r"))
(setq NR (read-line FIB))
(close FIB)
(not NR)
)
)
(WAIT 0.01)
)
"T.Willey" <nospam@address.withheld> ¦b¶l¥ó
news:16313191.1103831260841.JavaMail.jive@jiveforum1.autodesk.com ¤¤¼¶¼g...
| Quote: | I don't know what I did, but I'm glad you got it to work for you.
Happy Holidays.
Tim |
|
|
| Back to top |
|
 |
|
|
|
|