在数组上使用fgetc() [英] using fgetc() on array

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

问题描述

我正在尝试读取数组中的第一个字符,但我的语法似乎是错误的,因为它说我有错误。我已经将每行文本文件读入数组并使用fgetc,我试图查看每行的第一个字符是否为[]。我目前的编码是:

I am trying to read the first character in an array but my syntax seems to be wrong as it says I have an error. I have read each line a text file into an array and by using fgetc, I''m trying to see if the first character of each line is an "[". My current coding is:

展开 | 选择 | Wrap | 行号

推荐答案

@ phpnewbie26


fgetc()期望一个文件资源句柄作为它的参数。


顺便说一句,你可以通过访问它来检查字符串的第一个字符会是一个数组:

@phpnewbie26
fgetc() expects a file resource handle as it''s parameter.

Incidentally, you can check the first character of a string by accessing it like you would an array:

展开 | 选择 | Wrap | 行号


hm ..好像似乎在起作用。我的问题是,我不知道如何指出让'说'
hm..doesnt seem to be working. My problem is that I don''t know how to point to let''s say


string [2]并获得它的第一个字符。我试过
string[2] and get it''s first character. I tried


这篇关于在数组上使用fgetc()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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