How to create a sort of stringarray ? I would like to store the available wfd.cFileName in an array. Later I could address them by their numbers.
#include <windows.h> #include <iostream> using namespace std; int main() {</iostream></windows.h>
WIN32_FIND_DATA wfd; char langarray_filename[200]; // ???; int langarray_fileposition[200]; int counter=1; HANDLE File_hnd; char buffer[50];
//################### File_hnd=FindFirstFile("languages_menu\*",&wfd); FindNextFile(File_hnd,&wfd); // .directory FindNextFile(File_hnd,&wfd); // .. directory - not needed
wsprintf(buffer,"%u %s",counter,wfd.cFileName); MessageBox(0,buffer,"pos name",MB_OK);
//strcpy(langarray_filename[counter],wfd.cFileName); ??? // This causes: // [Error] invalid conversion from 'char' to 'char*' [-fpermissive]
langarray_fileposition[counter]=counter;
while (FindNextFile(File_hnd,&wfd)) { counter++; wsprintf(buffer,"%u %s",counter,wfd.cFileName); MessageBox(0,buffer,"pos name",MB_OK);
langarray_fileposition[counter]=counter; }
FindClose(File_hnd); //###################################
for( int a = 1; a <= counter; a = a + 1) {
wsprintf(buffer,"%u",langarray_fileposition[a]); MessageBox(0,buffer,"pos",MB_OK); }
return 1;
}
I am having problems with the upload. I didn't write this: int main() {
it must be: int main() {
Log in to post a comment.
How to create a sort of stringarray ?
I would like to store the available wfd.cFileName in an array.
Later I could address them by their numbers.
#include <windows.h>
#include <iostream>
using namespace std;
int main() {</iostream></windows.h>
WIN32_FIND_DATA wfd;
char langarray_filename[200]; // ???;
int langarray_fileposition[200];
int counter=1;
HANDLE File_hnd;
char buffer[50];
//###################
File_hnd=FindFirstFile("languages_menu\*",&wfd);
FindNextFile(File_hnd,&wfd); // .directory
FindNextFile(File_hnd,&wfd); // .. directory - not needed
wsprintf(buffer,"%u %s",counter,wfd.cFileName);
MessageBox(0,buffer,"pos name",MB_OK);
//strcpy(langarray_filename[counter],wfd.cFileName); ???
// This causes:
// [Error] invalid conversion from 'char' to 'char*' [-fpermissive]
langarray_fileposition[counter]=counter;
while (FindNextFile(File_hnd,&wfd))
{
counter++;
wsprintf(buffer,"%u %s",counter,wfd.cFileName);
MessageBox(0,buffer,"pos name",MB_OK);
//strcpy(langarray_filename[counter],wfd.cFileName); ???
// This causes:
// [Error] invalid conversion from 'char' to 'char*' [-fpermissive]
langarray_fileposition[counter]=counter;
}
FindClose(File_hnd);
//###################################
for( int a = 1; a <= counter; a = a + 1) {
wsprintf(buffer,"%u",langarray_fileposition[a]);
MessageBox(0,buffer,"pos",MB_OK);
}
}
Last edit: claus michael cuntze 2019-09-24
I am having problems with the upload.
I didn't write this:
int main() {
it must be:
int main() {
Last edit: claus michael cuntze 2019-09-24