hari_poddar2009 wrote: > --- In [email protected], Thomas Hruska <thru...@...> wrote: >> hari_poddar2009 wrote: >>> --- In [email protected], Thomas Hruska <thruska@> wrote: >>>> hari_poddar2009 wrote: >>>>> i need to write a program that checks for the existence of a file in the >>>>> application data folder referred by the environment variable %APPDATA%. >>>>> If it does not exist the file will be created, written to, compressed and >>>>> closed. if it exists then the file will be opened using LZOPenFile(). The >>>>> end of file will be sought and the file will be written to. Then the file >>>>> will be closed with LZClose(). My code is listed below: >>>>> >>>> <snip> >>>>> i am using the lcc win32 compiler and am getting the error message: >>>>> "undefined reference to _lzopenf...@12" in the line which calls >>>>> INT result=LZOpenFile(name2ptr,openPtr,OF_READWRITE); >>>>> please help! >>>> This is a linker issue. You probably need to add 'lz32.lib' to the >>>> linker dependency/library options. >>>> >>> i created a new project and added the source file with my code to it. >>> i also mentioned 'lz32.lib' in the linker settings dialog box. i rebuilt >>> the make file as prompted and then compiled the project. i still got the >>> same error i mentioned in my previous post! >> You mentioned that you are using lcc win32, which I'm not familiar with. >> This is a linker error you will have to figure out. Alternatively, >> you could try using LoadLibrary()/GetProcAddress(). >> >> -- >> Thomas Hruska >> CubicleSoft President >> Ph: 517-803-4197 >> >> *NEW* MyTaskFocus 1.1 >> Get on task. Stay on task. >> >> http://www.CubicleSoft.com/MyTaskFocus/ >> > > > yes i have been able to solve the problem in part by using LoadLibrary() and > GetProcAddress(). i have been able to decompress the file (after it has been > created and compressed) using LZOpenFile(). > > Now i want to append data to it. i used WriteFile() but the file's previous > data is getting overwritten. How do i make sure that the new data is appended > and not overwritten on previous data. Could u tell me if 'zlib' library is of > any use here? here's my latest code:
You can only "overwrite" files in a ZIP file (delete and then add). And it is best to copy everything to a whole new archive because ZIP is not a good format to use as a file system. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
