C programming, Unix I/O

    Date: 10/23/05 (Computer Geeks)    Keywords: no keywords

    Anyone see a syntax error here??


    switch(buf.st_mode & S_IFMT)
    {
    case S_IFDIR : //"directory";
    printf("/");
    break;
    case S_IFLNK : //"symbolic link";
    char *lnk; // *******
    lnk = (char*) malloc(sizeof(char));
    readlink(dp->d_name, lnk, 256);
    printf("%s -> %s\n", dp->d_name, lnk);
    free(lnk);
    break;
    case S_IFREG : //"regular file";
    if ((buf.st_mode & S_IXUSR) || (buf.st_mode & S_IXGRP) || (buf.st_mode & S_IXOTH))
    printf("*");
    break;
    default :
    printf("undetermined");
    }

    I'm getting this error:

    UnixLs.c: In function `optionl':
    UnixLs.c:205: error: syntax error before "char"
    UnixLs.c:206: error: `lnk' undeclared (first use in this function)
    UnixLs.c:206: error: (Each undeclared identifier is reported only once
    UnixLs.c:206: error: for each function it appears in.)
    *** Error code 1
    make: Fatal error: Command failed for target `UnixLs.o'

    On the line that I have stars on. Help me!

    Source: http://www.livejournal.com/community/computergeeks/802767.html

« You guys are the best by... || Help! »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home