Use gets() of fgets() to read in a whole line of text into a predefined temp
storage buffer. Eg if keyboard buffer is 128 characters (just an eg) then
assign char temp[128] and validate this by counting the number of characters
going into temp and once full send contents of temp to a file, reset temp to
zero and continue adding words left in the overflow. You will have ot
include a method of implementing the possiability of breaking a word in two
in this case search for the first blank space prior to the max storage
buffer becoming full and send that data to a file then continue the filling
of the temp buffer from the space onwards.
Memory can also be allocated dynamically (malloc) and using sizeof(temp) in
this case when storing the text to use memory more efficently.
Kind Regards
Renato Parletta........
To reply send mail to: [EMAIL PROTECTED]
ICQ No: 13078952
"l can only assume that a "Do Not File" document
is filed in a "Do Not File" file."
Senator Frank Church
Senate Intelligence Subcommittee Hearing, 1975
-----Original Message-----
From: Uly <[EMAIL PROTECTED]>
To: Torbjørn Kristoffersen <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, 4 August 1998 21:12
Subject: Re: Question
>
>
>On Sun, 2 Aug 1998, Torbjørn Kristoffersen wrote:
>
>> I'm wondering if there is an easy way to make a C program that asks the
>> user
>> for his whole name, and stores the whole name in a string.
>> If I use:
>>
>> "scanf("%s",name);"
>>
>> It'll only pick up the first word in his name.
>>
>> Maybe if I use getch() and store every letter in a string, even spaces,
>> but there must
>> be an easier way to do this..
>>
>> How can I store whole names taken from stdin, or f. ex. whole sentences?
>
> Well I used gets() but now the gcc is telling me that function
>is dangerous so it should be not used. But insted you can use fgets().
>Uly
>
>
>