Bonjour,
j'essaye de parcourir les fichiers .tga situés dans un dossier particulier et dont le nom commence par une certaine chaine de caractere.
Ces deux informations sont stockees dans l'objet Sequence et sont accessible via getRepertoire() et getNom() qui renvoient des char*.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
 * @brief Scanne le dossier de la sequence pour lui ajouter les bons pointeurs images
 * @param sequence La sequence a remplir
 */
void
Chargeur::scannerSequence(Sequence* sequence)
{
#if defined MACOSX
  FSRef fs_rep;
  FSIterator fs_it;
  
  FSPathMakeRef((uchar*)sequence->getRepertoire(), &fs_rep, 0);
  FSOpenIterator(&fs_rep, kFSIterateFlat, &fs_it);
  
  FSSearchParams criteres_recherche;
  FSCatalogInfo			searchInfo1;
  FSCatalogInfo			searchInfo2;
	
	
	/*
	 * Initialize the searchCriteria, the searchInfo1 and the searchInfo2 records.
	 * These tell FSCatalogSearch what to find.
	 */
	criteres_recherche.searchTime 		= 0;					/* timeout as used by a Time Manager task, or 0 for no timeout */
	criteres_recherche.searchBits		= fsSBPartialName + fsSBFlAttrib;		/* fields to look at in searchInfo1 and searchInfo2 structs */
	criteres_recherche.searchName		= (UniChar*) sequence->getNom();
	criteres_recherche.searchNameLength = strlen(sequence->getNom());
	criteres_recherche.searchInfo1		= &searchInfo1;			/* the catalog info to match */
	criteres_recherche.searchInfo2		= &searchInfo2;			/* the catalog info mask */
	
	/* only match files (not directories) */
	searchInfo1.nodeFlags			= 0;						/* kFSNodeIsDirectoryBit set to 0 for files */ 
	searchInfo2.nodeFlags			= kFSNodeIsDirectoryMask;	/* check only this nodeFlag bit */
	
	/* search for this fileType */
	((FileInfo *)&searchInfo1.finderInfo)->fileType = 'TGA'; /* AppleWorks WP files */
	((FileInfo *)&searchInfo2.finderInfo)->fileType = (OSType)0xffffffff;
	
	/* search for this fileCreator */
//	((FileInfo *)&searchInfo1.finderInfo)->fileCreator = 'BOBO'; /* AppleWorks */
//	((FileInfo *)&searchInfo2.finderInfo)->fileCreator = (OSType)0xffffffff;
	
	/* find only visible files */
	((FileInfo *)&searchInfo1.finderInfo)->finderFlags = 0;
	((FileInfo *)&searchInfo2.finderInfo)->finderFlags = kIsInvisible;

	/* zero all other FileInfo fields */
	((FileInfo *)&searchInfo1.finderInfo)->location.v = 0;
	((FileInfo *)&searchInfo1.finderInfo)->location.h = 0;
	((FileInfo *)&searchInfo1.finderInfo)->reservedField = 0;
	
	((FileInfo *)&searchInfo2.finderInfo)->location.v = 0;
	((FileInfo *)&searchInfo2.finderInfo)->location.h = 0;
	((FileInfo *)&searchInfo2.finderInfo)->reservedField = 0;
	
  // nombre de fichiers trouves (1 ou 0)
  ulong nb_trouve;
  FSRef fs_image;
  HFSUniStr255 nom_image;
  
  while (FSCatalogSearch( fs_it, &criteres_recherche, 1, &nb_trouve, 0, kFSCatInfoNone, 0, &fs_image, 0, &nom_image) != errFSNoMoreItems)
  {
    CFStringRef str = CFStringCreateWithCharacters( kCFAllocatorDefault, 
                                                       nom_image.unicode, nom_image.length );
    char* output = NewPtr(CFStringGetLength(str)+1);
	// check output for NULL
	CFStringGetCString(str, output, CFStringGetLength(str)+1, kCFStringEncodingMacRoman);
    CFRelease( str );
    fprintf(stderr,"%s\n",output);
	
	delete output;
  }

#elif defined WINDOWS

#endif

}
Voila ce que j'obtiens :

Citation Envoyé par la console
objects.nib
InfoPlist.strings
Localizable.strings
keyedobjects.nib
objects.nib
objects.nib
keyedobjects.nib
keyedobjects.nib
objects.nib
InfoPlist.strings
Localizable.strings
keyedobjects.nib
objects.nib
objects.nib
keyedobjects.nib
keyedobjects.nib
objects.nib
InfoPlist.strings
Localizable.strings
keyedobjects.nib
objects.nib
objects.nib
keyedobjects.nib
keyedobjects.nib
objects.nib
J'avoue avoir copié des bouts de codes récupérés à droite à gauche mais je vois pas trop ce qui cloche. Quelqu'un peut -il m'aiguiller ?

merci