Hi all, I created a small program which reads in a text-file filled like a database with information and I made some PROCs to receive the single lines and to split those lines into the single information. Afterwards the whole stuff gets sorted into a listview (I like those :D ) However, I have a problem with getting the complete contents into the splitted buffer. The information are all complete except for the comment. It just gets corrupted (the following signs are missing) when it is more than about 260 chars. I made the buffer like this: CommentBuffer db 12000 dup (?) Can sometell me what I could do to get the complete contents no matter how large the comment is? I could post the source as well but it is very large :D Tell me if you want me to do so! Stefan
Posted on 2001-06-03 15:20:00 by Stefan Krause
hey, why do you want to store information in this kind of buffer? why don't you use GlobalAlloc and stuff like that to load the contents of the file in memory? and it's even easier to handle it.....
Posted on 2001-06-04 04:23:00 by [-alloces-]
why don't you use GlobalAlloc and stuff like that to load the contents of the file in memory?
Well, I already do that! I GlobalAlloc the file and read it into memory but I need to make the contents visible. It is supposed to be an editor for my file including the possibility to add new entries, delete entries, edit entries. I can sen you the proggy if you wish however it is not finished yet. If I send it to you then you will see what it is for exactly :D So, if anyone knows how to get all into the buffer (I know that all is inside the buffer, since I let a messagebox show the whole string before the parts are added to the listview) please help me! Stefan
Posted on 2001-06-04 06:13:00 by Stefan Krause
Are you using one of the string API functions? Some of those have limits around 100h. 260 decimal is exactly MAX_PATH, for instance.
Posted on 2001-06-07 01:18:00 by Larry Hammick
why don't you try to map the whole databasefile into memory at once (+ a work buffer of 10000)?

.DATA
            filename        db "database.dta",0
.DATA?
            fHandle         dd ?
            MapOfs          dd ?
            FileSize        dd ?
            Memory          dd ?
            mHandle         dd ?
            
.CODE                                 
        invoke  CreateFile,addr filename,GENERIC_READ+GENERIC_WRITE,
                FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL
        mov     fHandle,eax

        invoke  GetFileSize,fHandle,NULL
        mov     FileSize, eax          
        add     eax,10000
        mov     Memory,eax

        invoke  CreateFileMapping,fHandle,NULL,PAGE_READWRITE,0,eax,NULL
        mov     mHandle,eax
                                   
        invoke  MapViewOfFile,eax,FILE_MAP_WRITE,0,0,Memory
        mov     MapOfs,eax            

;eax points to the memory mapped file

        invoke  UnmapViewOfFile,MapOfs
        invoke  CloseHandle,mHandle
        invoke  CloseHandle,fHandle
        invoke  ExitProcess,0
use SetFilePointer and SetEndOfFile to increase your database (new entries/...)
Posted on 2001-06-14 17:07:00 by _drcmda