允许用户输入段落 [英] allowing user to enter paragraphs
问题描述
如何让我的程序用户输入段落分隔的段落
使用gets()或类似函数的
空格?
i想要用户能够输入任意数量的行,同时能够按b&b输入>输入>创建一个新行,当它们完成后,键入
"。< ENTER>"它停止插入信息。
-
Jesse Engle
< blockquote> Jesse Engle< je **** @ elementalsn.com>潦草地写道:
我如何允许我的程序的用户使用gets()或类似的函数输入由行
空格分隔的段落?
我希望用户能够输入任意数量的行,同时能够按<< enter>创建一个新行,当它们完成后,键入
。< ENTER>并且它会停止插入消息。
在循环中使用fgets(),当你只得到\ n时,停止程序。
-
/ - Joona Palaste(pa*****@cc.helsinki.fi)------------ - 芬兰-------- \
\-- http://www.helsinki.fi/~palaste ---------------------规则! -------- /
所有的花朵力量都与我的怒视能力无法匹敌!
- 蒙哥马利伯恩斯
那就是那件事。我想让它继续,如果用户按下< enter> ;,
表示新行,并继续收到用户输入的内容。
例如当用户按下
< enter>时,微软的单词不会自动关闭。它继续前进并获得用户输入的任何内容。
i需要这种功能。
-
Jesse Engle
" Joona I Palaste" < PA ***** @ cc.helsinki.fi>在留言中写道
news:c2 ********** @ oravannahka.helsinki.fi ...Jesse Engle< je **** @ elementalsn.com>潦草地写道:我如何允许我的程序用户使用gets()或类似的函数输入
行间隔分隔的段落?
< blockquote class =post_quotes>我希望用户能够输入任意数量的行,而
能够按下< enter>创建一个新行,当它们完成后,键入
。< ENTER>它会停止插入消息。
在循环中使用fgets(),当你只获得\ n时,停止程序。
> -
/ - Joona Palaste(pa*****@cc.helsinki.fi)-------------芬兰-------- \
\ - http://www.helsinki.fi/~palaste ---------------------规则! -------- /
所有那些花的力量都与我的怒视能力无法匹敌! - 蒙哥马利伯恩斯
" Jesse Engle" < JE **** @ elementalsn.com>在消息中写道
news:pR ****************** @ newssvr31.news.prodigy.c om ...
可能在其他非线性字符之前。
其中
表示新线路,并继续收到用户输入的内容。
如果输入== text +换行,继续。
如果输入==仅限换行,请停止。
例如,当用户按下
< enter>时,microsoft字不会自动关闭。它继续前进并获得用户输入的任何内容。
这不是一个很好的比较,因为MS Word使用GUI界面,
和菜单选项(或内置Windows界面)退出。
如果您希望用户能够使用空白行
来分隔输入的多个段落,然后只需将上面的内容扩展为使用两个(或者多少你喜欢的)''独立''
的'quit''信号换行符。
我需要那种功能。
你可以像Joona建议的那样在循环中使用''fgets()'来获取它。 />
-Mike
how can i allow a user of my program to enter paragraphs seperated by line
spaces using gets() or a similar function?
i want the user to be able to enter as many lines as they want, while able
to press <enter> to make a new line, and when they are done they type
".<ENTER>" and it stops inserting the message.
--
Jesse Engle
Jesse Engle <je****@elementalsn.com> scribbled the following:how can i allow a user of my program to enter paragraphs seperated by line
spaces using gets() or a similar function? i want the user to be able to enter as many lines as they want, while able
to press <enter> to make a new line, and when they are done they type
".<ENTER>" and it stops inserting the message.
Use fgets() in a loop, and when you only get "\n", stop the program.
--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"All that flower power is no match for my glower power!"
- Montgomery Burns
that''s the thing. i want it to continue if the user presses <enter>, which
signals a new line, and keep recieving what the user types.
for example, microsoft word doesn''t close itself when a user presses
<enter>. it keeps on going and getting whatever the user types.
i need that sort of functionality.
--
Jesse Engle
"Joona I Palaste" <pa*****@cc.helsinki.fi> wrote in message
news:c2**********@oravannahka.helsinki.fi...Jesse Engle <je****@elementalsn.com> scribbled the following:how can i allow a user of my program to enter paragraphs seperated by line spaces using gets() or a similar function?
i want the user to be able to enter as many lines as they want, while able to press <enter> to make a new line, and when they are done they type
".<ENTER>" and it stops inserting the message.
Use fgets() in a loop, and when you only get "\n", stop the program.
--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"All that flower power is no match for my glower power!"
- Montgomery Burns
"Jesse Engle" <je****@elementalsn.com> wrote in message
news:pR******************@newssvr31.news.prodigy.c om...that''s the thing. i want it to continue if the user presses <enter>,
Presumably preceeded by other nonnewline characters.
which
signals a new line, and keep recieving what the user types.
If input == text + newline, continue.
If input == newline only, stop.
for example, microsoft word doesn''t close itself when a user presses
<enter>. it keeps on going and getting whatever the user types.
That''s not a good comparison, since MS Word uses a GUI interface,
and a menu option (or the built-in Windows interface) to quit.
If you''d like for the user to be able to use a ''blank'' line
to delimit multiple paragraphs being input, then just extend
the above to using two (or however many you like) ''standalone''
newlines for the ''quit'' signal.
i need that sort of functionality.
And you can get it using ''fgets()'' in a loop as Joona suggests.
-Mike
这篇关于允许用户输入段落的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!