红联Linux门户
Linux帮助

新手求帮忙看一下为什么?

发布时间:2013-10-20 16:31:35来源:红联作者:懒猪必备啊
#include
#include
#include
#include
#include
#define BUFES PIPE_BUF
int main(void)
{
FILE *fp;
char *cmd="cat hello.c";
char *buf[BUFSZ];
if((fp=popen(cmd,"r"))==NULL)
{
perror("fail to popen");
exit(1);
}
while ((fgets(buf,BUFSZ,fp))!=NULL)
printf("%s",buf);
pclose(fp);
exit(0);
}
编译后出现如下提示
recat.c:11:11: 错误: ‘BUFSZ’未声明(在此函数内第一次使用)
recat.c:11:11: 附注: 每个未声明的标识符在其出现的函数内只报告一次
求大神帮忙看一下 在线等
文章评论

共有 8 条评论

  1. gh131461 于 2013-12-20 12:29:08发表:

    。。。。

  2. bg4smw 于 2013-10-23 08:14:50发表:

    呵呵,这是我们新手常见的错误。有的时候就是一个英文字符按错了,所以养成在按下enter键的时候,请先查看一遍。

  3. flyingsnow0102 于 2013-10-22 23:22:49发表:

    果然是写错了

  4. Rr41c8yda 于 2013-10-22 10:00:15发表:

    Brunton Boatyard is a boutique tavern located by the attractive town of Fort Cochin. What earns the hostel brownie points namely the truth that it namely located at Fort Cochin, a town with a cosmopolitan character The hostel likewise draws tourists who are seeing as some pastime and frolic by the seashore The informal plus laidback ambience of the inn namely a refreshing alter from your normal formal hotels.
    Once inside the hostel you want be transferred to the Colonial age For the accurate reason, this tavern will be much loved by the sweethearts of history plus civilization Memories of the bygone epoch comes rushing apt you, once you capture the sights of the terracotta floors,wide verandas and tiled-roofs . The enormous punkahs - fans accustom during earlier periods - plus the archaic furniture accentuates,all put attach imparts a quite heritage feel apt the inn
    The hostel which was originally a Victorian ship-building yard is currently below the ownership of the CGH Group. The rooms along the hostel have a healthy potion of orthodox charts and procreated antiques that makes it a class individually Dining by the inn namely a pleasure for it serves one assortment of cuisines, ranging from the Syrian Christian apt traditional Kerala.

  5. Rr43o2jda 于 2013-10-22 09:58:22发表:

    mla, the erstwhile summer central of Britishers,is a true blend of royalty, ethnicity plus modernity. The place namely blessed with unparalleled natural fascination plus attracts hordes of visitors. The colonial aura, which still descends above this mound station huddled amidst the Himalayas,works as a utter setting as a memorable experience. Each morning the sun rays filter amongst the pine plus oak trees, to wake the historical metropolis from sleep The early morning walks the horse rides plus fresh scented atmosphere casts such a spell that nothing seems extra pure among the earth.The mound station of Shimla is congratulated with all the bountiful aspects of nature. Cuddled amidst the jagged terrains of the Himalayan mountainous ranges, Shimla within Himachal Pradesh has a magical beg with its bloom carpeted valleys,great mountains, winding avenues moss-covered rocks and salubrious mountain atmosphere The unsurpassable magnetism of its landscape plus the bygone charm captured onward its monuments make the zone an ideal holiday getaway as tourists.
    How to Reach
    By Air
    The nearest airport namely the recently constructed aerodrome by 'Jubber Bhatti', located 28 km from the main metropolis navel Regular flights of Indian Airlines, Archan plus Jagsons interlock it to other places favor Delhi, Chandigarh, Kullu plus Dharamshala. Tourists voyaging to Shimla forward atmosphere need to disembark by the Jubber Bhatti aerodrome and board a bus/ cab to approximate Shimla.
    By Rail
    The highest handy railhead namely located by Kalka, 96 km from Shimla. Kalka namely connected to manifold necessity places forward broad gauge railroads However, from Kalka a contracted gauge toy train chugs uphill towards Shimla. This miniature train takes approximately 6 hr to approximate Shimla from Kalka plus attempts some breathtaking views during the journey
    By Road
    Shimla namely easily available from always the other districts among plus approximately Himachal Pradesh amongst a agreeable web of motorable roads. It is well-connected according the National Highway No22 to places favor Delhi, Chandigarh and Mandi. Different types of land transport, from public buses to deluxe cars are available for tourists traveling to Shimla.
    More Information on:
    Tags: Shimla hotels | Hotels surrounded Shimla | Shimla Hotel Packages | Shimla Car Packages | Visit Shimla | Travel to Shimla | Shimla Tour | Hotel East Bourne among Shimla | Budget Hotels within Shimla | Shimla hostel packages | Shimla automobile packages | Travel Shimla | Visit Shimla | Travel to Shimla | Shimla Tour | Honeymoon tour archive | Honeymoon package surrounded Shimla | Shimla honeymoon package | Shimla Hotel

  6. announcement 于 2013-10-21 08:42:30发表:

    帮顶下

  7. micy1985 于 2013-10-20 21:03:14发表:

    你这问题也太简单了,写程序时小心点,常名都对不上;

    指针的使用还要去复习下,把复杂指针的意义理解好!

  8. micy1985 于 2013-10-20 21:00:40发表:

    #include
    #include
    #include
    #include
    #define BUFSZ PIPE_BUF

    int main(void)
    {
    FILE *fp;
    char *cmd="cat hello.c";
    char buf[BUFSZ];
    if((fp=popen(cmd,"r"))==NULL) {
    perror("fail to popen");
    exit(1);
    }
    while ((fgets(buf,BUFSZ,fp))!=NULL)
    printf("%s",buf);
    pclose(fp);
    exit(0);
    }