Hi,
i working on a small project to learn again how to make some stuff in C. I use Borland C++ 5.01. Ok at the moment i try to make a new dll file (the second one) and i want to put a nice search function (found on planet-source code) into this dll. I made already a dll and it seems that it works but now it seems that my Borland doesn´t like me or my code...here my source code of my second dll. I can not compile this source code with included iostream.h. If i include this iostream (i must do it, cause i need it for the search function) the Borland compiler gives me this error message:
error: IOSTREAM.H(24,2):Error directive: Must use C++ for the type iostream.
What should i change to compile this source code ?
Code:[...header...] #include <stdio.h> #include <conio.h> #include <string.h> #include <iostream.h> #include <windows.h> /********************************************** Does a recursive search for an archived file starting at the root directory passed....... base conditions: out of directorys to call or found the file.......................... **********************************************/ __declspec(dllexport) void findPath(char *root, char *file, char *buffer) { //stuff for the file searc loop HANDLE h; BOOL ok; WIN32_FIND_DATA fd; char start[256];//character var's... char dir[256]; bool found=false;//search flag char test[1000];//paranoia strcpy(test,buffer);//using test as a temp location int tlen = strlen(file);//get length of file name if(testStrings(test,file))//test for it { return;//return if it is there...no need to look further } if(strlen(root)>0)//if they passed a valid string for the root { strcpy(start, root);//modify it to search for all files/folders.... strcat(start,"\\*"); } //steven at http://world.std.com/~swmcd/steven/ms/bugs.html#right gets credit for the for loop idea..processing inside the loop is mine for (h =FindFirstFile(start, &fd), ok=1;h!=INVALID_HANDLE_VALUE && ok; ok=FindNextFile(h, &fd)) { if(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)//use bitwise and to test the returned fileattributes { strcpy(dir,fd.cFileName);//assuming it is a dir so copy over if((testStrings(dir,".")==false))//make sure it is not the defaul parent... { if((testStrings(dir,"..")==false))//..or child indicator, copying this over results in infinite recursion { if(found == false)//if we have not found the file in this current call then make a call { strcpy(test,root); strcat(test,"\\"); strcat(test,dir); findPath(test,file,buffer);//and recurse through them..... }//end found }//end .. test }//end . test }//end dir test if(fd.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE)//now use bitwise and to check for file flag { found = testStrings(file,fd.cFileName);//if we have a file is it the one we want? if(found == true) { strcpy(buffer,root);//if it is create the full path name to it and copy into buffer strcat(buffer,"\\"); strcat(buffer,fd.cFileName); }//end found test }//end archive test }//end for int error = GetLastError(); if (error!=ERROR_NO_MORE_FILES) printf("Find*File: error %d\n", error); if (h!=INVALID_HANDLE_VALUE) { BOOL ok = FindClose(h); if (!ok) printf("FindClose: error %d", GetLastError()); } } //test's to charS for equality, returns true or false /*static bool */ testStrings(char *s1, char *s2) { int x1=0; bool ret=true; x1 = strlen(s1); if(strlen(s2) != (unsigned)x1) { ret=false; } else { for(int i=0;i<x1;i++) { if(s1[i] != s2[i]) ret = false; } } return ret; }



LinkBack URL
About LinkBacks



I used to be an adventurer like you... then I took an arrow to the knee.
..thanks very much