Strings Problem 
Author Message
 Strings Problem

I am having a problem processing input with my program.

I use scanf to scan some characters
Ex. "I want a house."

When I put it in string format using gets(string) and print it out, the
beginning letters are missing.
Ex. "ant a house."

Does anyone know what is going on or to fix this?

Thanks



Fri, 23 Aug 2002 03:00:00 GMT  
 Strings Problem
On Mon, 6 Mar 2000 22:30:09 -0800, "Running Miles"

Quote:
> I am having a problem processing input with my program.

> I use scanf to scan some characters
> Ex. "I want a house."

> When I put it in string format using gets(string) and print it out, the
> beginning letters are missing.
> Ex. "ant a house."

> Does anyone know what is going on or to fix this?

> Thanks

Yes, there is a bug in your code.  Looking in my crystal ball, I see
that it is on line 44.  If I'm wrong you will just have to post some
code to show us.

Jack Klein
--
Home: http://jackklein.home.att.net



Sat, 24 Aug 2002 03:00:00 GMT  
 Strings Problem
Both scanf() and gets() are input functions. Though it is
hard to be sure without seeing the code, probably you are
reading the first half of the input with scanf() and the
second half with gets().

Neither scanf() nor gets() by the way are particularly
recommended functions for user input. It is very difficult
if not impossible to handle erroneous input with either.

* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful



Sat, 24 Aug 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. string[,] or string[][] Problem ?

2. String problem in a DLL that connects .NET to other systems

3. String problems

4. Very odd string problem

5. more string problems in vc++7

6. STL String problem in VC7

7. String Problem:Invalid Cast Exception

8. Please help with function calling and string problems

9. Encrypting a string problem.

10. String problem

11. String Problem

12. Command line arguments/string problem with *argv[]

 

 
Powered by phpBB® Forum Software