|
|
|||||||
Good Morning to ALL. I have used the ReadFileTail function and it works great. My problem starts when i'm trying to use the script on my DC. I have tried the script on my local machine and everything works well then i copied the script to the DC and made the relevant changes and it doesn't read the lines in the file. It seems that there is problem reading from this particular file since it works on a different file. The file i wanr to read from is a regular log file with the archive attribute. here are the relevan code lines: Code: $text = ReadFileTail ("N:\RetalixLogs\datam.log", 10) WriteFile ("N:\RetalixLogs\DataCheck.txt", $text) PrintTo2 ("N:\RetalixLogs\DataCheck.txt","\\dc\OkiSvn") I'm trying to read the 10 last lines from the 'datam.log' file and to write them into the 'DataCheck.txt' file and to print it. As i mentioned at the begining with defferent files it works great, any suggestions will be appriciated. |
||||||||
|
|
|||||||
Ddady, Only UDF's should be in the forum. If you have any questions about a UDF please make a post is basic or advanced scripting. If you put a link in the post to the UDF we all know what UDF your are using. Can a mod please move this thread to basic or advanced scripting? |
||||||||
|
|
|||||||
ddady, you might try to catch an error after readfiletail: Code: $text = ReadFileTail ("N:\RetalixLogs\datam.log", 10) if @error "Error " + @error + " [" + @serror + "] occurred" get $ exit 1 endif WriteFile ("N:\RetalixLogs\DataCheck.txt", $text) PrintTo2 ("N:\RetalixLogs\DataCheck.txt","\\dc\OkiSvn") |
||||||||
|
|
|||||||
Mart, sorry i didn't know, wont happen again. Jochen, i will try it and will post the results. |
||||||||
|
|
|||||||
That's is the error i'm getting "urred 24 [The program issued a command but the command length is incorrect.] occ" |
||||||||
|
|
|||||||
Originally Posted By: ddady Mart, sorry i didn't know, wont happen again. .... No worries. It has been moved already so all is ok. |
||||||||
|
|
|||||||
Hmmm ... odd error, never had this before. To make sure it isn't caused by the udf, run this and post your results: Code: break on $_ = setoption("WrapAtEOL","ON") $_ = open(1,"N:\RetalixLogs\datam.log") if not @error $_ = readline(1) while not @error $_ ? $_ = readline(1) loop $_ = close(1) else "" + @error + " [" + @serror + "]" endif get $_ exit 1 |
||||||||
|
|
|||||||
Ok, It opens the content of the 'datam.log' file in a command window. Could it be that this function can't handle a file with 796 lines? I'm just guessing here since it workd perfect on a file with 50 lines. The instructions on this function says that there is no limit or if i missunderstood 1000 lines. But still i need only 10 lines which is the default. ReadFileTail() |
||||||||
|
|
|||||||
Maybe a stupid question but did you also include the PadStr UDF? The ReadFileTail UDF is dependant of that UDF. Quote: .... DEPENDENCIES Function PadStr() http://www.kixtart.org/cgi-bin/ultimatebb.cgi? ubb=get_topic;f=12;t=000223#000000 .... PadStr() - Left or Right pad a string |
||||||||
|
|
|||||||
Ok, i think i found out something interesting. The original file i'm trying to read from is with 796 lines. I have deleted line from there until i reached 500 lines and WALLA, it works! SO i guess the function cant handle more than that which is very strange [and here is the knockout] i have created a whole different file and put into it 793 lines and it worked so i realy frustrated. Any Ideas ???????? |
||||||||
|
|
|||||||
Hmm ... maybe a character in the file that causes readline to choke on (It is designed to read ASCII files only) |
||||||||
|
|
|||||||
I didn't see any special characters. Anyway i manage to work around it with the ReadFile() Function The printing of the lines is not nice as it comes out from the other function but it works. If there is a way to arrange the 5 lines that way they would come out in separate lines insted of all 5 lines in one line i will be more than glad to hear about it. |
||||||||
|
|
|||||||
Show some code and one of us will place some @crlf macros in it |
||||||||
|
|
|||||||
Are you using KiXtart 4.53? Code: Break On Dim $ @KIX Get $ |
||||||||
|
|
|||||||
Well, of course I am using 4.53, But that's not the point, no? |
||||||||
|
|
|||||||
Thanx JOCHEN, You just had to say "@crlf". :-) I have managed to do it. |