3

What happens when I don't give directory path? Where the file is exported?

DEFINE VARIABLE cPath AS CHARACTER NO-UNDO.
cPath = STRING(MTIME) + "_user.out".

OUTPUT TO VALUE (cPath).
MESSAGE "In side a file".
OUTPUT CLOSE.
Bharat
  • 177
  • 7

2 Answers2

4

The file is exported to your client's working directory. That is typically the directory where you've been in when you have started the client process (_progres, prowin, prowin32).

Mike Fechner
  • 6,627
  • 15
  • 17
3

You can use FILE-INFO to find out:

DEFINE VARIABLE cPath AS CHARACTER NO-UNDO.
cPath = STRING(MTIME) + "_user.out".

OUTPUT TO VALUE (cPath).
MESSAGE "In side a file".
OUTPUT CLOSE.

file-info:file-name = "./" + cPath.
message cPath file-info:full-pathname.

By the way - if you are hoping that using MTIME() to prefix the file name is going to result in a unique file name then you may be disappointed. Multiple processes running at the same time could have collisions. Or you may have old stale files left over from crashed sessions.

Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
  • this is for windows. What about linux client working directory? – Bharat Jul 31 '20 at 05:42
  • I don't understand what you are asking. The code above works just fine to determine the working directory for either Windows or Linux. – Tom Bascom Jul 31 '20 at 15:45
  • When I execute the code above in linux its finding the user working directory not client working directory. Why is that? – Bharat Jul 31 '20 at 23:48
  • Please define what you mean by “client” and “user” and why you think they are different terms in this context. Or maybe you could explain what other working directory you are expecting to see returned. – Tom Bascom Aug 01 '20 at 01:15