Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef string FileName<30>;
- struct Output {
- FileName list_of_files<100>;
- int errorCode;
- };
- program MYPROG {
- version MYVERS {
- Output getFileList(string) = 1;
- } = 1;
- } = 0x20000013;
- // in server
- Output * getfilelist_1_svc(char ** direName, struct svc_req * rp)
- {
- static Output output;
- output.list_of_files.list_of_files_val = malloc(sizeof(char *)*100);
- u_int i = 0;
- for (i = 0; i < 100; ++i)
- output.list_of_files.list_of_files_val[i] = malloc(sizeof(char) * 30);
- DIR * mDir;
- struct dirent * entry;
- int count = 0;
- mDir = opendir(*direName);
- while ((entry = readdir(mDir)) != NULL) {
- if (entry->d_type == DT_REG) {
- strcpy(output.list_of_files.list_of_files_val[count], entry->d_name);
- count++;
- output.list_of_files.list_of_files_len = count;
- }
- closedir(mDir);
- }
- return &output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement