使用fgets()将字符串存储在内存中 [英] Using fgets() to store string in memory

查看:79
本文介绍了使用fgets()将字符串存储在内存中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好


使用fgets()在内存中存储字符串的语法是什么?我理解fgets()可以解决存储字符串的问题,该字符串比声明的数组的大小多出
字符。


谢谢


Peter Mount
in**@petermount.au.com

推荐答案

Peter Mount写道:
Peter Mount wrote:

使用fgets的语法是什么()将字符串存储在内存中?我理解fgets()可以解决存储字符串的问题,该字符串的字符数多于声明的数组的大小。

What''s the syntax for using fgets() to store a string in memory? I
understand that fgets() can solve the problem of storing a string
that has more characters than the size of the declared array.




不,它不可能。但是,你可以尝试ggets.zip:


< http://cbfalconer.home.att.net/download/>


-

Chuck F(cb********@yahoo.com)(cb********@worldnet.att.net)

可用于咨询/临时嵌入式和系统。

< http://cbfalconer.home.att.net>使用worldnet地址!



No it can''t. However, you can try ggets.zip from:

<http://cbfalconer.home.att.net/download/>

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!





Peter Mount写道:


Peter Mount wrote:
你好

使用fgets()将字符串存储在内存中的语法是什么?我理解fgets()可以解决存储字符串的问题,该字符串的字符数多于声明的数组的大小。
Hello

What''s the syntax for using fgets() to store a string in memory? I
understand that fgets() can solve the problem of storing a string that has
more characters than the size of the declared array.




它可以解决尝试读取流的问题,该流可能比声明的数组的大小更多的字符(相反,

到函数获取)。


该函数的概要是:

#include< stdio.h>

char * fgets(char * restrict s,int n,

FILE *限制流);

问题7.1的faq可以通过一个可能的函数使用

流是标准输入。 http://www.eskimo.com/~ scs / C-faq / q7.1.html


使用clc googles搜索或网页搜索

函数的在线资源。寻求包括标准在内的离线资源。一个新闻组

讨论可能不是全面讨论或描述该功能的最佳资源。


-

Al Bowers

美国佛罗里达州坦帕市

mailto: xa ****** @ myrapidsys.com (删除x发送电子邮件)
http://www.geocities.com/abowers822/



It can solve the problem of attempting to read a stream that may
be more characters than the size of the declared array (as opposed
to function gets).

The synopsis of the function is:
#include <stdio.h>
char *fgets(char * restrict s, int n,
FILE * restrict stream);
Question 7.1 of the faq can over one possible use of the function where
the stream is stdin. http://www.eskimo.com/~scs/C-faq/q7.1.html

Use a c.l.c googles search or a web search for online resource of the
function. Seek offline resources including the Standard. A newsgroup
discussion is probably not the best resource for a comprehensive
discussion or descripition of the function.

--
Al Bowers
Tampa, Fl USA
mailto: xa******@myrapidsys.com (remove the x to send email)
http://www.geocities.com/abowers822/


In< 40 **** ******@news.iprimus.com.au> 彼得山 <在** @ petermount.au.com>写道:
In <40**********@news.iprimus.com.au> "Peter Mount" <in**@petermount.au.com> writes:
使用fgets()在内存中存储字符串的语法是什么?我理解fgets()可以解决存储字符串的问题,该字符串的字符数多于声明的数组的大小。
What''s the syntax for using fgets() to store a string in memory? I
understand that fgets() can solve the problem of storing a string that has
more characters than the size of the declared array.




废话!在你最喜欢的C书中读取fgets()的规格

而不是理解事情。


顺便说一句,恕我直言,fgets()是一个完全无用的库函数,由某人跳过设计阶段发明。
< br $>
Dan

-

Dan Pop

DESY Zeuthen,RZ集团

电子邮件: Da*****@ifh.de


这篇关于使用fgets()将字符串存储在内存中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆