[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Re: [TEKNIK] Prefix oversigt





On Sun, 6 Aug 2006, Jens Bang wrote:

Hej Bo,

Jeg sender den her til sslug-programmering (og BCC'er den til dig, da jeg ikke
ved om du abbonnerer på sslug-programmering). Den hører vist ikke længere til
på sslug-teknik.  :-)


Det gør jeg selvfølgelig.

Jeg prøvede at compilere det. Hvilket gav en masse fejl i tråd med disse:

prefixlist.c:41: error: stray ÿÿ\194ÿÿ in program

Email er ikke den bedste måde at distribuere C programmer på.


Da jeg havde fjernet alle de fejl, var der denne warning tilbage:

   workspace = (char *)malloc(value);
workspace og value er erklæret sådan:
   char *workspace;
   int value = 0;

Hvorfor advarer den om en omerklæring af malloc? Det er jo bare en typecast af
det resultat der kommer fra malloc, eller hvad?


Det er nok fordi jeg har glemt en #include <stdlib.h> hvor prototypen for malloc befinder sig.


Med hensyn til at finde de længste kæder, kan du jo bare søge efter den sidster _ i filnavnet. Det bliver så til noget i den her stil:

 p = entry->d_name;

 while (*p != (char)NULL && *p != '.') p++;

 while (p > entry->d_name)
  {
    if (*p == '_')
      {
        *p = (char)NULL;
        value = addmatch(entry->d_name, filestat.st_size);
        if (value < 0) return value;
        break;
      }
    p--;
  }

Jeg kan ikke komme en anden simpel metode uden at du må lave en mere kompleks algoritme til at matche filnavnet.

Mvh. Bo



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-09-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *