Displaying 4 results from an estimated 4 matches for "of1name".
Did you mean:
if_name
2019 May 31
2
use of buffers in sprintf and snprintf
No, that will make it even worse since you'll be declaring a lot more memory that you actually have.
The real problem is that you're ignoring the truncation, so you probably want to use something like
if (snprintf(tempname, sizeof(tempname), "%s.%d", of1name, j) >= sizeof(tempname)) Rf_error("file name is too long");
BTW: most OSes systems have a path limits that are no lower than 256 so you should allow at least as much.
Cheers,
Simon
> On May 29, 2019, at 11:49 AM, jing hua zhao <jinghuazhao at hotmail.com> wrote:
>
&g...
2018 May 28
5
readLines function with R >= 3.5.0
On 28.05.2018 11:07, G?bor Cs?rdi wrote:
> stdin() is not the same as file("stdin"), see the note in ?stdin.
In particular stdin() works in an interactive session but not when R -f
/ Rscript is used, since it does not wait for the user to input anything:
$ R -f readLines.R
R version 3.5.0 (2018-04-23) -- "Joy in Playing"
Copyright (C) 2018 The R Foundation for Statistical
2019 May 31
0
use of buffers in sprintf and snprintf
...>
> No, that will make it even worse since you'll be declaring a lot more memory that you actually have.
>
> The real problem is that you're ignoring the truncation, so you probably want to use something like
>
> if (snprintf(tempname, sizeof(tempname), "%s.%d", of1name, j) >= sizeof(tempname)) Rf_error("file name is too long");
>
> BTW: most OSes systems have a path limits that are no lower than 256 so you should allow at least as much.
On MS Windows, there's actually a limit of 255 characters, cf.
http://www.aroma-project.org/howtos/UseLo...
2019 May 30
2
use of buffers in sprintf and snprintf
...tween 1 and 10 bytes into a region of size between 0 and 127 [-Wformat-truncation=]
hap_c.c:392:46: warning: ?%d? directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 127 [-Wformat-truncation=]
Essentially, I have
#define MAX_FILENAME_LEN 128
char of1name[MAX_FILENAME_LEN],of2name[MAX_FILENAME_LEN], tempname[MAX_FILENAME_LEN];
...
snprintf(tempname,sizeof(tempname),"%s.%d", of1name, j);
It looks I could get around with
#define MAX_FILENAME_LEN 128
#define MAX_FILENAME_LEN2 256
char of1name[MAX_FILENAME_LEN],of2name[MAX_FILENAME_LEN...