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

gets()

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



Joined: 12 Jan 2009
Posts: 33

View user's profile Send private message

gets()
PostPosted: Fri Jan 23, 2009 4:44 am     Reply with quote

is there anyway to use gets(); but have it terminate at a set ammount of data coming in rather than at a RETURN.

I would like to be able to send an ASCII character, say 'M' followed by 60bytes of data. So far i can do this fine with gets() but i need to follow it up with RETURN

thanks for any help,
Matt
Ttelmah
Guest







PostPosted: Fri Jan 23, 2009 6:10 am     Reply with quote

Don't use 'gets'. Look in the include file "input.c", and use the function 'get_string' instead. This behaves like 'gets', except that it allows you to set an upper length limit as well. It is by far the 'better' function to use, since gets, is so dangerous if a string arrives that is longer than expected....

Best Wishes
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