- bool ReadFileToArray(string &array[],string FileName,string WorkFolderName,int devider='\x90')
- {
- bool res=false;
- int FileHandle;
- string tempArray[64000],currString;
- int stringCounter;
- string FullFileName;
-
- if (StringLen(WorkFolderName)>0) FullFileName=StringConcatenate(WorkFolderName,"\",FileName);
- else FullFileName=FileName;
- //----
- //Print("A ",FileName);
- FileHandle=FileOpen(FullFileName,FILE_READ|FILE_CSV,devider);
- if (FileHandle!=-1)
- {
- while(!FileIsEnding(FileHandle))
- {
- currString=FileReadString(FileHandle);
- tempArray[stringCounter]=currString;
- Print(stringCounter,": ",currString);
- stringCounter++;
- }
- stringCounter--;
- if (stringCounter>0)
- {
- ArrayResize(array,stringCounter);
- for (int i=0;i<stringCounter;i++) array=tempArray;
- res=true;
- }
- FileClose(FileHandle);
- }
- else
- {
- Print("A ",FileName,"|B ",GetLastError());
- }
- //----
- return(res);
- }
复制代码
|