comparison src/file-io.cc @ 2936:87cb7614257d

[project @ 1997-05-06 05:46:00 by jwe]
author jwe
date Tue, 06 May 1997 05:46:00 +0000
parents 66ef74ee5d9f
children 38de16594cb4
comparison
equal deleted inserted replaced
2935:a57fdc645b1f 2936:87cb7614257d
1272 1272
1273 return retval; 1273 return retval;
1274 } 1274 }
1275 1275
1276 DEFUN (tmpnam, args, , 1276 DEFUN (tmpnam, args, ,
1277 "tmpnam ()\n\ 1277 "tmpnam (DIR, PREFIX)\n\
1278 Return unique temporary file name.") 1278 Return unique temporary file name.")
1279 { 1279 {
1280 octave_value retval; 1280 octave_value retval;
1281 1281
1282 if (args.length () == 0) 1282 int len = args.length ();
1283 retval = file_ops::tempnam (); 1283
1284 if (len < 3)
1285 {
1286 string dir = len > 0 ? args(0).string_value () : string ();
1287 string pfx = len > 1 ? args(1).string_value () : string ("oct-");
1288
1289 if (! error_state)
1290 retval = file_ops::tempnam (dir, pfx);
1291 }
1284 else 1292 else
1285 print_usage ("tmpnam"); 1293 print_usage ("tmpnam");
1286 1294
1287 return retval; 1295 return retval;
1288 } 1296 }