john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Create a linked list of files with c and Win CE

#define LIST "dir"

VOID getListing( linebufferptr head , char currentdirectory[ 256 ] )
{
    linebufferptr current;
    linebufferptr temp ;

    FILE* fp;
    fp=NULL;

    system( "dir /b > dirlist.txt" );
    fp = fopen( "dirlist.txt" , "r");
    if( fp == NULL )
    {   printf("\nfopen error\n");  
    exit(1);
    }

    current = head;
    do{
        temp = addToListEnd( current );
      current ->next = temp ;
        current = temp;

    }while (   fgets( temp->line , sizeof( temp->line ) , fp )   ) ;


    fclose( fp );
    system( "del dirlist.txt" );

}/* end function getListing() */

/*
  fp = tmpfile( );
 but how to redirect system into tempfile?
  fp = fopen( TEMPFILENAME , "r");

*/

  • « Custom buttons for Win CE
  • clearRect »

Published

Jun 3, 2010

Category

c

~70 words

Tags

  • c 95
  • getlisting 1
  • linked list 2
  • programming 9
  • win-ce 40