macoxy
21st October 2005, 11:43
How to write a file to users local directory.
the same as asci device wich send's report file to your's local dir.

beginer
21st October 2005, 11:51
Hi,

You can use seq.open() , seq.write() & seq.close() functions of standard BaaN to create the file in user's home on server.

For more info on this functions refer BaaN Help.

macoxy
21st October 2005, 11:52
I know this but how do i know which user am'i

beginer
21st October 2005, 12:04
Hi ,

U can use the predefined variable logname$ to get the Current Login code.
As u mentioned earlier & if i m not wrong u want to create file for the user in his home directory...in that case...

If u do not provide the absolute path in the seq.open() function & provide only the filename then the file is automatically created in the home of user running the session.

So in this case u dont need to find the user also.

ganesh_kapase
21st October 2005, 15:19
Hi Maco

Try this one !!!!


declaration:
string path.id(100)

choice.cont.process:
on.choice:
path.id = sprintf$("\\it_ganesh\sharedoc\xyz.txt")
seq.id = seq.open(path.id,"w")
if seq.id < 1 then
message("Error in creating file")
exit()
else
create.header()
ret1 = seq.puts(hold.header,seq.id)
read.main.table()
seq.close(seq.id)
endif


etc. etc.

No need to find out user login code. Create shared folder named as 'sharedoc' on any one PC (ex.it_ganesh). It will create xyz.txt file in the sharedoc folder of it_ganesh PC.

Hope this solves your problem.

Good Luck


GANESH

dorleta
21st October 2005, 17:17
I belive that this can help you. If you need to use this function you have to write in declaration section:

#pragma used dll "ottdllbw"

Good luck


function extern long app_start(
const string commandline(),
const string directory(),
const string stdin(),
const string stdout(),
const string stderr() )

function extern long app_status(
long app.id )

function extern long client2server(
const string source(),
const string dest(),
long text.mode,
[ long text.mode.server ] )

function extern long create.local.directory(
string dirent(256) )

function extern long remove.local.directory(
string dirent(256) )

function extern long remove.local.file(
string filename(256) )

function extern seq.close.local(
long lfn )

function extern long seq.fstat.local(
const string filename(),
ref long nr.bytes )

function extern long seq.open.local(
const string filename(),
const string mode(),
long text.mode )

function extern long seq.read.local(
ref string buf(),
ref long size,
long lfn )

function extern long seq.write.local(
const string buf(),
long size,
long lfn )

function extern long server2client(
const string source(),
const string dest(),
long text.mode,
[ long progress.window ] )

function extern set.read.size(
ref long size,
long lfn )