[Csnd] fprints issue: printing strings (%s) fails

Hey hey,
I have problems printing an Svariable (string) to a file. Consider these instruments:

instr Print
   Sname chnget "MyString"
   Sfilename = strcat(Sname, ".txt")
   fprints(Sfilename,"%s", Sname)
   turnoff
endin

instr Caller
   Sname = "Output"
   chnset(Sname, "MyString")
   schedule("Print", 0, .1)
   turnoff
endin

Of course, in the real code the string Sname is generated dynamically. The output is only one control character (<ASCII 32). Strange, because Sfilename is properly created, so Sname should be valid and assigned when the fprints opcode runs.

Best wishes,

Jeanette

A quick verification... If I cut&paste your code below, I get:
"error: Unable to find opcode entry for 'fprints' with matching argument types:
Found: (null) fprints SSS"

OTOH, the "%s" in fprints is essentially superfluous here. If I just use
" fprints(Sfilename, Sname)" It works fine! A definite bug, I'd say!

  -- Pete --

Mar 31 2021, Pete Goodeve has written:
...

OTOH, the "%s" in fprints is essentially superfluous here. If I just use
" fprints(Sfilename, Sname)" It works fine!

...
Hm, I could use strcat for a simple case then, but my real string format
would be:
fprints(Sfilename, "path/%s-%d-%d-%d.wav", Sname, iNote, iVelocity, iRobin)
For that the %s is definitely useful. Again, this could be worked around
using a prior sprintf, if that works.

Best wishes,

Jeanette

Maybe related to the fprintks bug I reported earlier?

https://github.com/csound/csound/issues/1377

Victor might have fixed it already and it should be in the next release or if you build from source.

Maybe related to the fprintks bug I reported earlier? See
https://github.com/csound/csound/issues/1377

No, that was fixed and working. There was another issue reported and deemed fixed, maybe that fix needs to be looked at.

Do you have an example of what is not working as expected? With an example I would have something to test but at the moment I am struggling to get a n angle on this.

⁣Sent from TypeApp ​

Apr 4 2021, John ff has written:

Do you have an example of what is not working as expected?

I have attached a small zipfile, containing both a CSD and the output text on my system, using ArchLinux's version of Csound:
Csound version 6.15 (double samples) Sep 7 2020

If the zip is blocked by the list, let me know and I'll upload it somewhere.

Thanks and best wishes,

Jeanette

With an example

I would have something to test but at the moment I am struggling to get a n angle on this.

(Attachment fprints_bug.zip is missing)

As far as I can tell your examle runs correctly. Output is
~/csound6> more fprints_bug.txt
Hello world.
~/csound6> od -cx fprints_bug.txt
0000000 H e l l o w o r l d .
            6548 6c6c 206f 6f77 6c72 2e64
0000014

This is with latest gitub code (with some unllated exeriments in action).
OTOH I a not aware of any change here, but whatever it was seems fixed

--Csound version 6.15 beta (double samples) Mar 28 2021
[commit: 1ee0bda4d893ac292946b59ca5a210ef7929c046]

Perhaps it is time for a release?

==John ff

Apr 4 2021, john has written:
...

This is with latest gitub code (with some unllated exeriments in action).
OTOH I a not aware of any change here, but whatever it was seems fixed

...
Thank you for the verification, so I'll just have to compile from source
or wait till the changes get downstream to our packages. I can work
with that. :slight_smile:

Best wishes,

Jeanette

I've got a few adjustments to do to the new filters, and update the manual.

Also, I'd like to see if we could wait for the Web Audio work to be completed before the release.

Prof. Victor Lazzarini
Maynooth University
Ireland

Hah! Turns out that I'm still running 6.14 from a year ago, which
I didn't realize, and was getting the same bug as Jeanette. I just
switched to the partition which actually *does* have 6.15 from last
September, and it gives the correct output! So I guess we're good...
Sorry about that. (:-/)

  -- Pete --

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here