priPrinter: File Read - priPrinter

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

File Read

#1 User is offline   adamlaw 

  • Newbie
  • Pip
  • Group: Senior Members
  • Posts: 3
  • Joined: 08-August 11

Posted 11 July 2015 - 10:44 AM

I cannot get File reads to work. Neither "ra" or "r". Currently I am reading from the registry which is OK.

local vs_dir
local retval
local vi_1

if (1>0){
 local f=File("c:/temp/dopus.txt","+ra");
 if(f.ok){
   for(local i=0;i<10;i++) {
        f.Write("test text\r\n","sa");
   }
   vi_1=f.Seek(1, "s");
   retval=MsgBox("Seek:" + vi_1);  
   vs_dir=f.Read("sa"); 
   retval=MsgBox("Dir:" + vs_dir);  	
 }
}


Am I doing something silly?

Regards

Adam
0

#2 User is offline   Alex 

  • Administrator
  • Group: Administrators
  • Posts: 238
  • Joined: 28-February 10
  • LocationHungary

Posted 11 July 2015 - 08:20 PM

we will check this.
0

#3 User is offline   Alex 

  • Administrator
  • Group: Administrators
  • Posts: 238
  • Joined: 28-February 10
  • LocationHungary

Posted 13 July 2015 - 08:23 PM

Please try small update:
www.priprinter.com/alpha/priPrinterProSetup.exe

There were some mistakes. Also please see how file may be opened. If first attempt failed, we may try to create file.

local vs_dir
local retval
local vi_1

 local f=File("z:/dopus.txt","ra+");
 if(!f.ok){
 f=File("z:/dopus.txt","w");
 if(f.ok){
   for(local i=0;i<10;i++) {
        f.Write("test text\r\n","sa");
   }}
}
if(f.ok){
   vi_1=f.Seek(0, "s");
   //retval=MsgBox("Seek:" + vi_1);  
   //vs_dir=f.Read("sa",4); 
   vs_dir=f.Read("sa"); 
   retval=MsgBox("Dir:" + vs_dir);      
 }

0

#4 User is offline   adamlaw 

  • Newbie
  • Pip
  • Group: Senior Members
  • Posts: 3
  • Joined: 08-August 11

Posted 18 July 2015 - 08:10 AM

Thank you - it works great!
Adam
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users