Displaying 20 results from an estimated 2978 matches for "sprintf".
Did you mean:
snprintf
2009 Mar 20
1
sprintf causes a segfault (PR#13613)
Full_Name: Wacek Kusnierczyk
Version: 2.8.0 and 2.10.0 r48163
OS: Ubuntu 8.04 Linux 32bit
Submission from: (NULL) (129.241.198.172)
the following code illustrates a problem with sprintf which consistently causes
a segfault when applied to certain type of arguments. it also shows
inconsistent consequences of the segfault:
(e = tryCatch(stop(), error=identity))
# e is an error object
sprintf('%d', e)
# error in sprintf("%d", e) : unsupported type...
2009 Apr 21
8
incorrect output and segfaults from sprintf with %*d (PR#13667)
Full_Name: Wacek Kusnierczyk
Version: 2.10.0 r48365
OS: Ubuntu 8.04 Linux 32bit
Submission from: (NULL) (129.241.110.141)
sprintf has a documented limit on strings included in the output using the
format '%s'. It appears that there is a limit on the length of strings included
with, e.g., the format '%d' beyond which surprising things happen (output
modified for conciseness):
gregexpr('1', sprintf(...
2020 Mar 11
1
[PATCH] builder: templates: add the AppStream repo
...lder/templates/make-template.ml b/builder/templates/make-template.ml
index 8d26177bf..a4e2f37fb 100755
--- a/builder/templates/make-template.ml
+++ b/builder/templates/make-template.ml
@@ -1238,7 +1238,8 @@ and make_rhel_yum_conf major minor arch =
major major minor in
sprintf "%s/Server/%s/os" topurl arch,
sprintf "%s/source/SRPMS" topurl,
- Some (sprintf "%s/Server/optional/%s/os" arch topurl,
+ Some ("Optional",
+ sprintf "%s/Server/optional/%s/os" arch topurl,
sp...
2009 Mar 18
1
sprintf("%d", integer(0)) aborts
In R's sprintf() if any of the arguments has length 0
the function aborts. E.g.,
> sprintf("%d", integer(0))
Error in sprintf("%d", integer(0)) : zero-length argument
> sprintf(character(), integer(0))
Error in sprintf(character(), integer(0)) :
'fmt' is not a...
2023 Sep 02
1
Fails to install Rfast package
.../include/RcppArmadillo/interface/RcppArmadilloForward.h:25:
In file included from
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include/RcppCommon.h:168:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include/Rcpp/internal/r_coerce.h:255:7:
warning: 'sprintf' is deprecated: This function is provided
for compatibility reasons only. Due to security concerns
inherent in the design of sprintf(3), it is highly recommended that
you use snprintf(3) instead. [-Wdeprecated-declarations]
::sprintf(buff, "%02x", from);
^
/Library...
2015 Nov 24
2
How to create a sprintf call in IR
Hi,
I created a global char array, char buffer[1024]. I want to call a function
to append the string information to the buffer repeatedly. For example, I
need to implement the following code, where length, a, b, c, are global
variables.
int length = 0;
length += sprintf(buffer+length, "str%d", a);
length += sprintf(buffer+length, "str%c", b);
length += sprintf(buffer+length, "str%d", c);
I did it in the following way.
1. Create the global array:
IntegerType CHARTYPE = IntegerType::get(llvm::getGlobalContext(), 8);
ArrayType*...
2002 May 14
2
NaN/NA and sprintf double format
With a (late prerelease of) 1.5.0 on Windows, using sprintf on NaN
yields garbage when the number of decimal is specified while it
works fine for NA:
> sprintf("%.2f", NA)
[1] "0.00"
> sprintf("%.2f", NaN)
[1] "-1.#J"
Not specifying the decimal precision lets both print garbage:
> sprintf("%f",...
2012 Jul 30
2
sprintf doesn't care of escape characters
Hi.
I am having trouble with something that should be simple. I am unable
to get sprintf using escape sequences:
> sprintf("a\nb")
[1] "a\nb"
> sprintf("a\"bc\"d")
[1] "a\"bc\"d"
But it seems to need them any way:
> sprintf("a\"bc"d")
Error: unexpected symbol in "sprintf("a\"bc&q...
2010 Oct 25
1
[LLVMdev] sprintf -> snprintf conversion
Hello, llvmdev!
I'm using LLVM on OpenBSD. This project proactively advocates usage
of 'secure' C apis, especially related to memory bounds checking.
Thus using functions like sprintf/strcpy/etc usually spits out a
linker warning in base toolchain like this one:
/home/proger/dev/llvm/Debug+Asserts/lib/libclangFrontend.a(DocumentXML.o) (.text+0xc65): In function `clang::DocumentXML::escapeString(char const*, unsigned long)':
/home/proger/dev/llvm/tools/clang/lib/Frontend/Doc...
2003 Oct 31
1
strange sprintf() behaviour ?
This is quite strange behaviour - at least for R-novice as myself....
Consider this:
> testf <- function() { x <-2; sprintf("%s %f", "x =", x); return(x) }
> result <- testf()
> testf <- function() { x <-2; sprintf("%s %f", "x =", x) }
> result <- testf()
> testf()
[1] "x = 2.000000"
Apparently adding return() statement and invoking function lik...
2006 May 03
3
sprintf question
How would one go about getting sprintf to use the
values of a vector without having to specify each
argument individually?
> v <- c(1, 2, -1.197114, 0.1596687)
> iv <- c(3, 1, 2, 4)
> sprintf("%9.2f\t%d\t%d\t%8.3f", v[3], v[1], v[2], v[4])
[1] " -1.20\t1\t2\t 0.160"
Essentially, desired effect w...
2013 Feb 15
2
sprintf in system command
...C:/Users/.../dssp-2.0.4-win32.exe -i
data_1.txt -o data_1.dssp
I used the system command as:
system
('C:/Users/.../dssp-2.0.4-win32.exe -i data.txt -o data.dssp')
it worked.
Now I want to use the program on a list of files, so for that I used a
for loop and sprintf
for (i in 1:10) {
system
('C:/Users/.../dssp-2.0.4-win32.exe -i sprintf("data_%s.txt",i) -o
sprintf("data_%s.dssp",i)')
but I received the following error
No such file...
2017 May 23
2
Inconsistency in handling of numeric input with %d by sprintf
I initially thought this is "documented behaviour". ?sprintf says:
Numeric variables with __exactly integer__ values will be coerced to
integer. (emphasis mine).
Turns out this only works when the first value is numeric and not NA, as
shown by the following example:
> sprintf("%d", as.numeric(c(NA,1)))
Error in sprintf("%d", as.nume...
2017 May 19
2
Inconsistency in handling of numeric input with %d by sprintf
Consider
#as.numeric for emphasis
sprintf('%d', as.numeric(1))
# [1] "1"
vs.
sprintf('%d', NA_real_)
> Error in sprintf("%d", NA_real_) :
invalid format '%d'; use format %f, %e, %g or %a for numeric object
>
I understand the error is correct, but if it works for other numeric input...
2008 Nov 14
0
(PR#13283) R crashes on sprintf with bad format specification
...t.org=20
> [mailto:r-devel-bounces at r-project.org] On Behalf Of Prof Brian Ripley
> Sent: Friday, November 14, 2008 2:25 AM
> To: Duncan Murdoch
> Cc: R-bugs at r-project.org; ocheyett at bonddesk.com;=20
> r-devel at stat.math.ethz.ch
> Subject: Re: [Rd] (PR#13283) R crashes on sprintf with bad=20
> format specification
>=20
> As R's sprintf is a wrapper for the OS's sprintf, misuse does=20
> run the risk of crashing from OS, and when it does the error=20
> will come from the implementation of sprintf (which for R for=20
> Windows is the Trio library).
&...
2008 Nov 14
0
(PR#13283) R crashes on sprintf with bad format
...ilto:r-devel-bounces at r-project.org] On Behalf Of Prof Brian Ripley
>> Sent: Friday, November 14, 2008 2:25 AM
>> To: Duncan Murdoch
>> Cc: R-bugs at r-project.org; ocheyett at bonddesk.com;
>> r-devel at stat.math.ethz.ch
>> Subject: Re: [Rd] (PR#13283) R crashes on sprintf with bad
>> format specification
>>
>> As R's sprintf is a wrapper for the OS's sprintf, misuse does
>> run the risk of crashing from OS, and when it does the error
>> will come from the implementation of sprintf (which for R for
>> Windows is the Trio li...
2020 Sep 20
2
sprintf, check number of parameters
Dear R developers,
I am wondering if this should raise an error or a warning.
> sprintf('%.f, %.f', 1, 2, 3)
[1] "1, 2"
I am aware that R has ?numbered? sprintf arguments (sprintf('%1$.f', ?), and in that case, omissing of specific arguments may be intended. But in the usual syntax, omission of an argument is probably a mistake.
Thank you for your considera...
2017 May 23
2
Inconsistency in handling of numeric input with %d by sprintf
...ourse we should be passing integer when we use
> %d. It's an edge case in how we printed ITime objects in data.table:
>
>
> On Tue, May 23, 2017 at 11:53 AM, Joris Meys <jorismeys at gmail.com> wrote:
>
>> I initially thought this is "documented behaviour". ?sprintf says:
>>
>> Numeric variables with __exactly integer__ values will be coerced to
>> integer. (emphasis mine).
>>
>> Turns out this only works when the first value is numeric and not NA, as
>> shown by the following example:
>>
>> > sprintf("%d...
2009 Dec 21
2
a little bug for the function 'sprintf' (PR#14161)
Dear R-ers,
I am a gratuate student from South China University of Technology. I fond
the function 'sprintf' in R2.10.1 have a little bug(?):
When you type in the example codes:
> sprintf("%s is %f feet tall\n", "Sven", 7.1)
and R returns:
[1] "Sven is 7.100000 feet tall\n"
this is very different from the 'sprintf' function in C/C++, for in C/C++,
the for...
2020 Nov 04
2
sprintf, check number of parameters
Dear Tomas,Thank you.Regarding the "unnumbered" arguments, i.e. sprintf('%f %f', 1, 2, 3). This was the case I wanted to report, here a warning can be very useful.Regarding the "numbered" arguments, that is, sprintf('%$1f %$3f', 1, 2, 3). Here, omission of an argument might be intended, for example, in an application with support for multiple...