marcos_antonio_ps
2009-Apr-27 13:15 UTC
[Wine] File access denied when printing from a Delphi application
Hello, everybody! I'm getting the following error when I'm trying to print from a Delphi application: File access denied. This printer routine in my application is a routine to print text. So it prints to a file in LPT1 . The source code is more or less like this: Code: procedure Print; var File: TextFile; begin AssignFile(File, 'LPT1'); Rewrite(File); try Writeln(File, '...'); // ... finally CloseFile(File); end; end; I think the error occur in the AssignFile or Rewrite procedures, when the application tries to generate the file that will hold the printing on the system. I'm almost sure that if I execute my application on Wine under root or superuser the printing will work, but we all know that we should not execute applications on Wine like that. So what's the solution to have file access in this case? Thank you. Marcos
vitamin
2009-Apr-27 14:51 UTC
[Wine] Re: File access denied when printing from a Delphi application
marcos_antonio_ps wrote:> I'm getting the following error when I'm trying to print from a Delphi application: > > File access denied. > > Code: > AssignFile(File, 'LPT1'); > >Make sure you can write to /dev/lp0
vitamin
2009-Apr-27 19:20 UTC
[Wine] Re: File access denied when printing from a Delphi application
marcos_antonio_ps wrote:> > vitamin wrote: > > Then add yourself to "lp" group and log-off, log-in. > > Another dumb question: can you tell me how to do this please?Code: man usermod
marcos_antonio_ps
2009-Apr-27 19:22 UTC
[Wine] Re: File access denied when printing from a Delphi application
vitamin wrote:> > Code: > man usermod > >Like this, for example: Code: usermod -a -G lp marcos
marcos_antonio_ps
2009-Apr-28 12:03 UTC
[Wine] Re: File access denied when printing from a Delphi application
vitamin wrote:> Then add yourself to "lp" group and log-off, log-in.When I execute the command: Code: usermod -a -G lp marcos I get the message: Code: usermod : unable to lock password file How can I solve this? Marcos
jay
2009-Apr-28 13:34 UTC
[Wine] Re: File access denied when printing from a Delphi application
marcos_antonio_ps wrote:> > > > Code: > usermod : unable to lock password file > > > > How can I solve this? > > Marcos-> You need root privileges for adding users to group. -> You can use the sudo command for executing a command with root privileges: Code: sudo usermod -a -G lp marcos I hope this helps, Jay
marcos_antonio_ps
2009-Apr-28 13:45 UTC
[Wine] Re: File access denied when printing from a Delphi application
jay wrote:> > -> You need root privileges for adding users to group. > -> You can use the sudo command for executing a command with root privileges: > > > Code: > sudo usermod -a -G lp marcos > > > > I hope this helps, > JayHello, Jay! Thanks a lot. It helped. Marcos