[ADMB Users] file name length

Ben Bolker bbolker at gmail.com
Tue Dec 14 11:36:40 PST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10-12-14 11:52 AM, Luis Ridao wrote:
> ADMB-help,
> 
> I was wondering what is the maximum length of a file name allowed in ADMB.
> 
> I seem to have problems when file names are too long. My tendency is to use
> decriptive file names. When they are reduced the problem is gone.
> 
> Thank in advance
> 
> 

  It looks like the limit is about 40 characters (example below, "toy" +
38 x's fails; "toy" + 36 works).

  (Consider this a plug for the R2admb package ...)

  cheers
    Ben Bolker


library(R2admb)

set.seed(101)
x <- rnorm(1000)

testfn <- function(n=200,verbose=FALSE) {
  fn <- paste(c("toy",rep("x",n)),collapse="")
  writeLines(c("PROCEDURE_SECTION",
               "",
               "  f+=norm2((x-mu)/sigma);"),
             con=file(paste(fn,"tpl",sep=".")))

  setup_admb()
  d1 <- do_admb(fn,
                data=list(x=x),
                params=list(mu=0.5,sigma=1),
                bounds=list(sigma=c(0,20)),
                checkparam="write",
                checkdata="write",
                verbose=verbose)
  unlink(fn)
  unlink(paste(fn,"tpl",sep="."))
  unlink(paste(fn,"_gen.tpl",sep=""))
}

testfn(n=1)
testfn(n=10)
testfn(n=50,verbose=TRUE) ## fails
## compile log:
## sh: Syntax error: "(" unexpected
testfn(n=25)
testfn(n=40)  ## fails
testfn(n=32)
testfn(n=36)
testfn(n=38) ## fails
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0Hx0gACgkQc5UpGjwzenN9ggCfZRuRyvTw/GgjFSCr/eKcxjd9
69QAnjenMF1+jAAJ0gjEWBpQxYSEKH3S
=5UAa
-----END PGP SIGNATURE-----



More information about the Users mailing list