Recent

Author Topic: mkstemps method  (Read 544 times)

comdora

  • New Member
  • *
  • Posts: 12
mkstemps method
« on: July 08, 2022, 03:59:48 pm »
Hi,
Does anyone know if the mkstemps function is implemented in Lazarus/freepascal?

https://man7.org/linux/man-pages/man3/mkstemps.3.html

Thanks in advance
Bojan
« Last Edit: July 08, 2022, 04:01:20 pm by comdora »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: mkstemps method
« Reply #1 on: July 14, 2022, 08:23:40 am »
Searching FPC source code:
Code: Bash  [Select][+][-]
  1. $ grep -ir mkstemp *
  2. packages/gtk2/src/glib/gfileutils.inc:function g_mkstemp(tmpl:Pchar):longint;cdecl;external gliblib name 'g_mkstemp';
  3. packages/libc/src/stdlibh.inc:function mkstemp(__template:Pchar):longint;cdecl;external clib name 'mkstemp';
  4. packages/libc/src/stdlibh.inc:function mkstemp64(__template:Pchar):longint;cdecl;external clib name 'mkstemp64';
  5. rtl/netwlibc/libc.imp: mkstemp,
  6. rtl/netwlibc/libc.pp:function mkstemp(_para1:Pchar):longint;cdecl;external libc_nlm name 'mkstemp';
  7. $ grep -ir stdlibh.inc *
  8. packages/libc/fpmake.pp:          AddInclude('stdlibh.inc');
  9. packages/libc/src/libc.pp:{$i stdlibh.inc}        // stdlib.h
  10.  
seems defined in libc unit. It's a deprecated unit, though. You might want to use the native Pascal cross platform SysUtils.GetTempDir and SysUtils.GetTempFileName, although for setting the permission and ownership you will still need *nix specific calls to BaseUnix.fpChown and BaseUnix.fpChmod.

 

TinyPortal © 2005-2018