Menu

#43 extensions for random filenames in datapath

open
None
5
2012-09-14
2011-03-25
Nick Vlad
No

Some people need to change their datapath, and some beginners do quite often. Others use relative datapaths, with the binary in the current directory. Adding ".rsf@" extensions to the randomly-generated binary file names (such as sfcp2IEUFwgu) would make them easily findable using disk search tools.

Discussion

  • Sergey Fomel

    Sergey Fomel - 2011-03-28

    Does not work - see "man mkstemp".

     
  • Nick Vlad

    Nick Vlad - 2011-03-30

    In stdlib.h there is a mkstemps ( notice the s at the end) that allows this. The mkstemps() function acts the same as mkstemp(), except it permits a suffix to exist in the template. The template should be of the form /tmp/tmpXXXXXXsuffix. The mkstemps() function is told the length of the suffix string. So a separate work copy of the string may be needed for this purpose. I may try to fix this when I catch some time...

     
  • Sergey Fomel

    Sergey Fomel - 2011-04-10

    mkstemps is appropriate but not standard and might be missing on some platforms, needs testing

     

Anonymous
Anonymous

Add attachments
Cancel