CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug Reports on this forum. Send them to support@ccsinfo.com

fprintf and usb_cdc_putc stream

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Jody



Joined: 08 Sep 2006
Posts: 172

View user's profile Send private message Send e-mail

fprintf and usb_cdc_putc stream
PostPosted: Tue Aug 23, 2022 1:21 am     Reply with quote

Hello,
What I am trying to do:
Send a string and a variable to the usb.
PIC send and receive single strings.. when using the printf command i.e.:
Code:
printf(usb_cdc_putc,"Tel_Temp 1 number  :);

this working ..
but when i do this:

Code:
fprintf(usb_cdc_putc,"Tel_Temp 1 number  : %s", tel_temp1);


the compiler complains: Stream must be a constant in the valid range .
And I don't understand what the problem is..
When I use the same command to a different stream it is fine...
so this goes with no problem:
Code:
fprintf(RS232,"Tel_Temp 1 number  : %s\n", tel_temp1)


what am I doing wrong??

Best regards,
Jody
Ttelmah



Joined: 11 Mar 2010
Posts: 18219

View user's profile Send private message

PostPosted: Tue Aug 23, 2022 10:32 am     Reply with quote

fprint, prints to streams.

usb_cdc_putc, is _not_ a stream. It is a output function for the usb.

You don't want to be using the stream function. Just:
Code:

printf(usb_cdc_putc,"Tel_Temp 1 number  : %s", tel_temp1);


printf, can write to any output function.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group