Hi,
I am converting a vc++ (32bit )application in 64bit application. I am totally new on VC++. Please give me your valuable advice and solution. If you tell me the step of converting of 32bit applicaton to 64bit application then it will be greate help. i got following error while i debuging this:

LNK2001: unresolved external symbol BZ2_bzclose jdefile.obj
LNK2001: unresolved external symbol BZ2_bzopen jdefile.obj
LNK2001: unresolved external symbol BZ2_bzread jdefile.obj
LNK2001: unresolved external symbol BZ2_bzstat64 jdefile.obj
LNK2001: unresolved external symbol BZ2_bzwrite jdefile.obj
LNK2001: unresolved external symbol BZ2_bzgetpos64 jdefile.obj
fatal error LNK1120: 6 unresolved externals


I am adding both jdefile (.h and .cpp) and bzlib.h file that has declaration of these functions

Thanks in advance

Attachments
/*-------------------------------------------------------------*/
/*--- Public header file for the library.                   ---*/
/*---                                               bzlib.h ---*/
/*-------------------------------------------------------------*/

/*--
  This file is a part of bzip2 and/or libbzip2, a program and
  library for lossless, block-sorting data compression.

  Copyright (C) 1996-2005 Julian R Seward.  All rights reserved.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions
  are met:

  1. Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.

  2. The origin of this software must not be misrepresented; you must 
     not claim that you wrote the original software.  If you use this 
     software in a product, an acknowledgment in the product 
     documentation would be appreciated but is not required.

  3. Altered source versions must be plainly marked as such, and must
     not be misrepresented as being the original software.

  4. The name of the author may not be used to endorse or promote 
     products derived from this software without specific prior written 
     permission.

  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

  Julian Seward, Cambridge, UK.
  jseward@bzip.org
  bzip2/libbzip2 version 1.0 of 21 March 2000

  This program is based on (at least) the work of:
     Mike Burrows
     David Wheeler
     Peter Fenwick
     Alistair Moffat
     Radford Neal
     Ian H. Witten
     Robert Sedgewick
     Jon L. Bentley

  For more information on these sources, see the manual.
--*/


#ifndef _BZLIB_H
#define _BZLIB_H

#ifdef __cplusplus
extern "C" {
#endif

#define BZ_RUN               0
#define BZ_FLUSH             1
#define BZ_FINISH            2

#define BZ_OK                0
#define BZ_RUN_OK            1
#define BZ_FLUSH_OK          2
#define BZ_FINISH_OK         3
#define BZ_STREAM_END        4
#define BZ_SEQUENCE_ERROR    (-1)
#define BZ_PARAM_ERROR       (-2)
#define BZ_MEM_ERROR         (-3)
#define BZ_DATA_ERROR        (-4)
#define BZ_DATA_ERROR_MAGIC  (-5)
#define BZ_IO_ERROR          (-6)
#define BZ_UNEXPECTED_EOF    (-7)
#define BZ_OUTBUFF_FULL      (-8)
#define BZ_CONFIG_ERROR      (-9)

typedef 
   struct {
      char *next_in;
      unsigned int avail_in;
      unsigned int total_in_lo32;
      unsigned int total_in_hi32;

      char *next_out;
      unsigned int avail_out;
      unsigned int total_out_lo32;
      unsigned int total_out_hi32;

      void *state;

      void *(*bzalloc)(void *,int,int);
      void (*bzfree)(void *,void *);
      void *opaque;
   } 
   bz_stream;


#ifndef BZ_IMPORT
#define BZ_EXPORT
#endif

#ifndef BZ_NO_STDIO
/* Need a definitition for FILE */
#include <stdio.h>
#endif

#ifdef _WIN32
//#ifdef _x64
#   include <windows.h>
#   ifdef small
      /* windows.h define small to char */
#      undef small
#   endif
#   ifdef BZ_EXPORT
#   define BZ_API(func) WINAPI func
#   define BZ_EXTERN extern
#   else
   /* import windows dll dynamically */
#   define BZ_API(func) (WINAPI * func)
#   define BZ_EXTERN
#   endif
#	define STAT64 __stat64
#else
#   define BZ_API(func) func
#   define BZ_EXTERN extern
#endif


/*-- Core (low-level) library functions --*/

BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( 
      bz_stream* strm, 
      int        blockSize100k, 
      int        verbosity, 
      int        workFactor 
   );

BZ_EXTERN int BZ_API(BZ2_bzCompress) ( 
      bz_stream* strm, 
      int action 
   );

BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( 
      bz_stream* strm 
   );

BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( 
      bz_stream *strm, 
      int       verbosity, 
      int       small_64
   );

BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( 
      bz_stream* strm 
   );

BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( 
      bz_stream *strm 
   );



/*-- High(er) level library functions --*/

#ifndef BZ_NO_STDIO
#define BZ_MAX_UNUSED 5000

typedef void BZFILE;

BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( 
      int*  bzerror,   
      FILE* f, 
      int   verbosity, 
      int   small_64,
      void* unused,    
      int   nUnused 
   );

BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( 
      int*    bzerror, 
      BZFILE* b 
   );

BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( 
      int*    bzerror, 
      BZFILE* b, 
      void**  unused,  
      int*    nUnused 
   );

BZ_EXTERN int BZ_API(BZ2_bzRead) ( 
      int*    bzerror, 
      BZFILE* b, 
      void*   buf, 
      int     len 
   );

BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( 
      int*  bzerror,      
      FILE* f, 
      int   blockSize100k, 
      int   verbosity, 
      int   workFactor 
   );

BZ_EXTERN void BZ_API(BZ2_bzWrite) ( 
      int*    bzerror, 
      BZFILE* b, 
      const void*   buf, 
      int     len 
   );

BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( 
      int*          bzerror, 
      BZFILE*       b, 
      int           abandon, 
      unsigned int* nbytes_in, 
      unsigned int* nbytes_out 
   );

BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( 
      int*          bzerror, 
      BZFILE*       b, 
      int           abandon, 
      unsigned int* nbytes_in_lo32, 
      unsigned int* nbytes_in_hi32, 
      unsigned int* nbytes_out_lo32, 
      unsigned int* nbytes_out_hi32
   );
#endif


/*-- Utility functions --*/

BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( 
      char*         dest, 
      unsigned int* destLen,
      char*         source, 
      unsigned int  sourceLen,
      int           blockSize100k, 
      int           verbosity, 
      int           workFactor 
   );

BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( 
      char*         dest, 
      unsigned int* destLen,
      char*         source, 
      unsigned int  sourceLen,
      int           small_64, 
      int           verbosity 
   );


/*--
   Code contributed by Yoshioka Tsuneo
   (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
   to support better zlib compatibility.
   This code is not _officially_ part of libbzip2 (yet);
   I haven't tested it, documented it, or considered the
   threading-safeness of it.
   If this code breaks, please contact both Yoshioka and me.
--*/

BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
      void
   );

#ifndef BZ_NO_STDIO
BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
      const char *path,
      const char *mode
   );

BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
      int        fd,
      const char *mode
   );
         
BZ_EXTERN int BZ_API(BZ2_bzread) (
      BZFILE* b, 
      void* buf, 
      int len 
   );

BZ_EXTERN int BZ_API(BZ2_bzwrite) (
      BZFILE* b, 
      const void* buf, 
      int     len 
   );

BZ_EXTERN int BZ_API(BZ2_bzflush) (
      BZFILE* b
   );

BZ_EXTERN void BZ_API(BZ2_bzclose) (
      BZFILE* b
   );

BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
      BZFILE *b, 
      int    *errnum
   );

BZ_EXTERN int BZ_API(BZ2_bzstat) (
		BZFILE *b,
		struct stat *buf
	);

BZ_EXTERN int BZ_API(BZ2_bztell)  (
		BZFILE *b
	);
BZ_EXTERN int BZ_API(BZ2_bzstat64) (
		BZFILE *b,
		struct STAT64 *buf
	);

BZ_EXTERN int BZ_API(BZ2_bzgetpos64) (
		BZFILE *b,
		fpos_t *addr
	);


#endif

#ifdef __cplusplus
}
#endif

#endif

/*-------------------------------------------------------------*/
/*--- end                                           bzlib.h ---*/
/*-------------------------------------------------------------*/
#include "stdafx.h"
#include <windows.h>
#include <share.h>
#include <sys\stat.h>
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/timeb.h>
#include <string.h>
#include <memory.h>
#include <io.h>
#include <errno.h>
#include <time.h>
#include <stdio.h>
#include "jdefile.h"
#include "hlib.h"
//#include "e2a.h"
#include <Winioctl.h>

//#include "bzlib.h"

#pragma warning( push )
#pragma warning( disable : 4996 )
#pragma warning( disable : 4244 ) //warning C4244: conversion from 'intptr_t' to 'long', possible loss of data
#pragma warning( disable : 4267 ) //warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data

#define BZMAGIC_SIZE 10
unsigned char bzmagic[BZMAGIC_SIZE] =
	{ 0x42, 0x5A, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59 };


#define GZMAGIC_SIZE 2
unsigned char gzmagic[GZMAGIC_SIZE] =
	{ 0x1F, 0x8B };

#define PKMAGIC_SIZE 4
unsigned char pkmagic[PKMAGIC_SIZE] =
	{0x04,0x03,0x4b,0x50};

#ifdef _USE_PKZIP
typedef struct{
	unsigned char magic[4];
	unsigned char version[2];
	unsigned char bitflag[2];
	unsigned char method[2];
	unsigned char lastmodfiletime[2];
	unsigned char lastmodfiledate[2];
	unsigned char crc[4];
	unsigned char compressedsize[4];
	unsigned char uncompressedsize[4];
	unsigned char filenamelength[2];
	unsigned char extrafieldlength[2];
    char filename[64*1024];
    char extrafield[64*1024];
}pk_localfile_header;



#endif



typedef struct{
	char name[100];
	char mode[8];
	char uid[8];
	char gid[8];
	char size[12];
	char mtime[12];
	char chksum[8];
	char type;
	char linkname[100];
	char magic[6];
	char version[2];
	char uname[32];
	char gname[32];
	char devmajor[8];
	char devminor[8];
	char prefix[155];
}tar_header;




jdefile::jdefile ()
{
	setprocessingstring ("");
	setcompletestring ("");
	m_callback = NULL;
	construct ();
}

jdefile::jdefile (int displayfreq)
{
	construct ();
	m_displayfreq = displayfreq;
}

jdefile::~jdefile ()
{
	if (m_method) {
		free (m_method);
	}
	if (m_curfile) {
		fclose (m_curfile);
	}
#ifdef _BZLIB_H
	if (m_compression == JDE_BZIP2) {
		if (m_BZcurfile) {
			BZ2_bzclose (m_BZcurfile);
		}
	}
#endif
}

int
jdefile::get_safe (void)
{
	return m_safe;
}

void
jdefile::set_safe (int safe)
{
	m_safe = safe;
}

bool jdefile::safe_open (const char *name)
{								//returns true no error false otherwise
	FILE *f;
	int mode;
	int pmode;
	int fd;
	time_t local_time;
	f = NULL;

#ifdef PKZIP
	if (m_compression==JDE_PKZIP){
		if(m_method[0]== 'r'){
			
			//get file size 
			char command [MAX_PKZIP_FILES*128+256] ="unzip.exe -l \"";
			strcat(command,name);
			strcat(command,"\" ");
			
			for( int i = 0;i<m_inner_file_count;i++){
				strcat(command,"\"");
				strcat(command,m_inner_file_names[i]);
				strcat(command,"\" ");
			}
			m_curfile = _popen(command,m_method);
			
			int size =0;
			char line[512];
			while(fgets(line,sizeof(line),m_curfile)){
				size=atoi(line+1);
			}

			m_finfo.size=size;
			if(_pclose(m_curfile)){//error opening file
				return false;
			}

			//open file with popen
			strcpy(command,"unzip.exe -p \"");
			strcat(command,name);
			strcat(command,"\" ");
			for( int i = 0;i<m_inner_file_count;i++){
				strcat(command,"\"");
				strcat(command,m_inner_file_names[i]);
				strcat(command,"\" ");
			}
			m_curfile = _popen(command,m_method);
			return true;
		}else if (m_method[0]=='w'){
			//open file
			char command [MAX_PKZIP_FILES*128+128] ="zip.exe -O \"";
			strcat(command,m_inner_file_names[0]);
			strcat(command,"\" \"");
			strcat(command,name);
			strcat(command,"\" -");
			m_curfile = _popen(command,"wb");
			fwrite("testing",strlen("testing")+1,1,m_curfile);
			if(_pclose(m_curfile)){
				return false;
			}
			m_curfile = _popen(command,m_method);

			return true;
		}else{
			return false;
		}

	}

#endif

	if ((m_usemagic) && (m_method[0] == 'r')) {

#if defined(_BZLIB_H)||defined(ZLIB_H) 
		f = fopen (name, "rb");
#if (BZMAGIC_SIZE > GZMAGIC_SIZE)
		unsigned char magic[BZMAGIC_SIZE];
#else
		unsigned char magic[GZMAGIC_SIZE];
#endif
		if (f == NULL) {
			return false;
		}
		fread (magic, 1, max(BZMAGIC_SIZE,GZMAGIC_SIZE), f);
		m_compression = JDE_DEFAULT_COMP;
		fclose (f);
		f = NULL;
#ifdef _BZLIB_H
		if (!memcmp (magic, bzmagic, 3)) {	//check for "BZh"
			if ((magic[3] <= '9') && (magic[3] >= '1')) {
				if (!memcmp (magic + 4, bzmagic + 4, 6)) {
					m_compression = JDE_BZIP2;
				}
			}
		}
#endif

#ifdef ZLIB_H
		if(!memcmp(magic,gzmagic,GZMAGIC_SIZE)){
			m_compression = JDE_GZIP;
		}
#endif

#endif //_BZLIB_H or ZLIB_H

	}
	
	if(m_method[0]=='w'){	//turn ntfs compression on or off
		if(m_compression==JDE_NTFS_COMP){
			static unsigned short in_buffer = COMPRESSION_FORMAT_LZNT1;
			static unsigned long bytes_returned;			
			int fd2 =_creat(name, _S_IREAD | _S_IWRITE);
			if(fd2 < 0) {
				//	Create failed.
				fprintf(stderr, "Could not create %s. errno = %d\n", name, errno);
				return false;
			}
			_setmode(fd2, _O_BINARY);
			int status = DeviceIoControl(
				(HANDLE)_get_osfhandle(fd2),	// handle to file 
				FSCTL_SET_COMPRESSION,      // dwIoControlCode
				&in_buffer,			        // input buffer
				sizeof(in_buffer),			// size of input buffer
				NULL,                       // lpOutBuffer
				0,                          // nOutBufferSize
				&bytes_returned,			// number of bytes returned
				NULL);						// OVERLAPPED structure
				
			if(status == 0) {
				//	Compression request failed.
				status = GetLastError();
				fprintf(stderr,"Could not set %s to uncompressed. GetLastError() returned %d\n",name, status);
			}
			_close(fd2); // done creating uncompressed file
		}else if(m_compression==JDE_UNCOMPRESSED){
			static unsigned short in_buffer = COMPRESSION_FORMAT_NONE;
			static unsigned long bytes_returned;			
			int fd2 =_creat(name, _S_IREAD | _S_IWRITE);
			if(fd2 < 0) {
				//	Create failed.
				fprintf(stderr, "Could not create %s. errno = %d\n", name, errno);
				return false;
			}
			_setmode(fd2, _O_BINARY);
			int status = DeviceIoControl(
				(HANDLE)_get_osfhandle(fd2),	// handle to file 
				FSCTL_SET_COMPRESSION,      // dwIoControlCode
				&in_buffer,			        // input buffer
				sizeof(in_buffer),			// size of input buffer
				NULL,                       // lpOutBuffer
				0,                          // nOutBufferSize
				&bytes_returned,			// number of bytes returned
				NULL);						// OVERLAPPED structure
				
			if(status == 0) {
				//	Compression request failed.
				status = GetLastError();
				fprintf(stderr,"Could not set %s to uncompressed. GetLastError() returned %d\n",name, status);
			}
			_close(fd2); // done creating uncompressed file			
		}
	}
	if ((m_compression == JDE_DEFAULT_COMP)||
		(m_compression == JDE_UNCOMPRESSED)||
		(m_compression == JDE_NTFS_COMP) ){
		if (m_safe) {
			m_current_retries = 0;
			while (1) {
				if ((m_max_retries > 0) && (m_current_retries >= m_max_retries)) {
					fprintf (stderr,
							 "Unable to open file %s in share denied write mode.\n"
							 "Maximum number of retries (%d)has been met\n",
							 name, m_max_retries);
					break;
				}
				pmode = 0;
				if (m_method[0] == 'r') {
					mode = _O_RDONLY;
				} else if (m_method[0] == 'w') {
					mode = _O_WRONLY | _O_CREAT;
					pmode = _S_IREAD | _S_IWRITE;
				} else if (m_method[0] == 'a') {
					mode = _O_WRONLY | _O_APPEND | _O_CREAT;
					pmode = _S_IREAD | _S_IWRITE;
				} else {
					fprintf (stderr, "Unknown mode %s\n", m_method);
				}
				if (m_method[1] == 'b') {
					mode |= _O_BINARY;
					if (m_method[2] != 0) {
						fprintf (stderr, "Unknown mode %s\n", m_method);
					}
				} else if (m_method[1] == 0) {
					mode |= _O_TEXT;
				} else {
					fprintf (stderr, "Unknown mode %s\n", m_method);
				}
				fd = sopen (name, mode, _SH_DENYWR, pmode);
				if (fd < 0) {
					//              if(errno == ENOENT ){
					//
					//              }
					if (m_safe < 0) {
						fprintf (stderr,
								 "Unable to open file %s in share denied write mode.\n",
								 name);
						break;
					} else {
						m_current_retries++;

						time (&local_time);
						fprintf (stderr,
								 "Unable to open file %s in share denied write mode.  \n"
								 "System time is %s"
								 "Sleeping for %d seconds before retry %d\n",
								 name, ctime (&local_time), m_safe,
								 m_current_retries);

						Sleep (m_safe * 1000);
					}
				} else {
					m_curfile = fdopen (fd, m_method);
					break;
				}
			}
		} else {
			m_curfile = fopen (name, m_method);
		}
		if (m_curfile) {
			if(m_callback){
				m_callback(this);
			}
#ifdef _USE_TAR
			if(m_tarred){
				return tar_open_next();
			}
#endif
			return true;
		} else {
			return false;
		}
	}
#ifdef _BZLIB_H
	else if (m_compression == JDE_BZIP2) {
		if (m_safe) {
			m_current_retries = 0;
			while (1) {
				if ((m_max_retries > 0) && (m_current_retries >= m_max_retries)) {
					fprintf (stderr,
							 "Unable to open file %s in share denied write mode.\n"
							 "Maximum number of retries (%d)has been met\n",
							 name, m_max_retries);
					break;
				}
				int
				  mode;
				int
				  pmode = 0;
				if (m_method[0] == 'r') {
					mode = _O_RDONLY;
				} else if (m_method[0] == 'w') {
					mode = _O_WRONLY | _O_CREAT;
					pmode = _S_IREAD | _S_IWRITE;
				} else if (m_method[0] == 'a') {
					mode = _O_WRONLY | _O_APPEND | _O_CREAT;
					pmode = _S_IREAD | _S_IWRITE;
				} else {
					fprintf (stderr, "Unknown mode %s\n", m_method);
				}
				if (m_method[1] == 'b') {
					mode |= _O_BINARY;
					if (m_method[2] != 0) {
						fprintf (stderr, "Unknown mode %s\n", m_method);
					}
				} else if (m_method[1] == 0) {
					mode |= _O_TEXT;
				} else {
					fprintf (stderr, "Unknown mode %s\n", m_method);
				}
				fd = sopen (name, mode, _SH_DENYWR, pmode);
				if (fd < 0) {
					/
//! author="David Ensminger (david.ensminger@bellsouth.com)"

#ifndef _JDEFILE_H_
#define _JDEFILE_H_
#ifdef DOXYGEN
namespace DataLibC{
#endif

#pragma once
// "jdefile.cpp"
#include <stdlib.h>
#include <stdio.h>
#include <sys/timeb.h>
#include <io.h>
#include <time.h>



#ifdef WIN32
#include <basetsd.h>
#endif

#ifdef __CYGWIN__
#define _MAX_PATH   260 /* max. length of full pathname */
#define _MAX_DRIVE  3   /* max. length of drive component */
#define _MAX_DIR    256 /* max. length of path component */
#define _MAX_FNAME  256 /* max. length of file name component */
#define _MAX_EXT    256 /* max. length of extension component */

struct _finddatai64_t {
        unsigned    attrib;
        time_t      time_create;    /* -1 for FAT file systems */
        time_t      time_access;    /* -1 for FAT file systems */
        time_t      time_write;
        __int64     size;
        char        name[260];
};

#endif	//cygwin


//if you wish to read and write bzip files natively from jdefile you need to 
//set _USE_BZIP2 flag true
//in VC++ .net go to project...properties...c/c++...preprocessor...
//and paste ;_USE_BZIP2 on to end of Preprocessor Definitions
#ifdef _USE_BZIP2
#include "bzlib.h"
#endif	//_USE_BZIP2

#ifdef _USE_GZIP
#include "zlib.h"
#endif


/// The maxinum line size for functions like getargv
#ifndef JDE_MAX_LINE_SIZE
#define JDE_MAX_LINE_SIZE (64*1024)
#endif

/*#define ERRORLEN 60
struct ERROR {
	char errortext[ERRORLEN];
	int msglen;
	int count;
	int errornum;
	int order;
	ERROR *prev;
	ERROR *next;
};*/


/// Types of compression built into JDEfile.
typedef enum {
	JDE_UNCOMPRESSED,	///< Use no compression
#ifdef _BZLIB_H
	JDE_BZIP2,			///< Use bzip2 compression
#endif
#ifdef ZLIB_H
	JDE_GZIP,			///< Use gzip compression
#endif
	JDE_NTFS_COMP,		///< Use NTFS compression
	JDE_DEFAULT_COMP,	///< Use filesystem default
#ifdef PKZIP
	JDE_PKZIP,
#endif
}JDE_FILE_COMPRESSION;

#ifdef PKZIP
#define MAX_PKZIP_FILES 128
#endif

struct FSTRUCT {
	FILE *f;
	INT64 flen;
	fpos_t pos;
	_timeb time_started;
	time_t time_started_timet;
};


/** A class for reading a writing a variety files.
    jdefile allows a program to open, read, and write files while showing status. 
    jdefile can also be used to read and write files compressed using the bzip2,gzip,
	or PKZIP libraries.
*/

class jdefile {
public:
	/// Simple Constructor
	jdefile();
	/// Other Constructor
	jdefile(int displayfreq);	
	/// Destructor
	~jdefile();	

	/** Open a file
	    @param file_name name of file to open if allowwildcards true then wildcards are accepted
	    @param method method string for opening file ("rb","r","w",..)
	    @param safe open file in write protected mode? seconds to sleep between retries
	    @param max_retries maximum number of retries in safe mode, -1 = infinity
		@author JDE
	*/
	bool open(	const char *file_name,	
				char *method="r",	
				int safe=0,			
				int max_retries=0);	

	
	/// Sets m_curfile to stdin for reading from standard in
	bool openstdin();

	/// Sets m_curfile to stdout for writing to standard out
	bool openstdout();

	/// closes a file
	bool close();

	/**	reads a line of text from current file, returns the number of bytes read
		@param buf  The buffer in which to place read data
		@param size  The max number of bytes to read
		@author JDE
		@param ebcdic  Is data ebcdic? If so do you want to translate it to ascii?
	*/
	int gets(char *buf,size_t size,bool ebcdic=false);

	/**	prints a line of text to current file, returns the number of bytes written
		@author JDE
		@return Number of bytes written
		@param format  Format string that defines rest of parameters
	*/
	int printf(const char *format, ...);

	/**	prints a line of text to current file, returns the number of bytes written
		@author JDE
		@return Number of bytes written
		@param format  Format string that defines rest of parameters
	*/
	//int printf(int stdout, const char *format, ...);
	int printf(int printToStdoutStdErr, const char *format, ...);

	/** Write a string to the file
		@author JDE
		@return Number of bytes written
		@param out Null terminited string to write
	*/
	int puts(const char *out);
	
	/** get the size of current file in bytes
		@return Number of bytes
	*/
	INT64 size();	

	/**	get name of current file
		@return the name of the current file
		@author JDE
	*/
	char *name();	
	
	
	/** get name of file
		@return the fully-qualified path name of the current file
		@author JDE
	*/
	char *fullname();	
	
	/** get current line count
		@return the current line count of the current file
		@author JDE
	*/
	int linecount();


	/** get the current offset
		@return the offset into the current file, in bytes
		@author JDE
	*/
	INT64 curpos();	

	/** reads data from the current file
		@return number of bytes read or 0 if eof or error
		@param buf buffer to read data to
		@author JDE
		@param num number of bytes to read
	*/
	size_t read(void *buf,size_t num);	

	/** writes num bytes to the current file
		@return number of bytes written
		@param buf data to write
		@param num number of bytes to write
		@author JDE
	*/
	int write(void *buf, size_t num);	

	/**	sets the display frequency
		@return true for success / false for failure 
		@author JDE
		@param  count The number of lines or read between refreshes (0 = off)
	*/
	bool setdisplayfreq(int count);	

	/** Get total lines read
		@author JDE
		@return the total number of lines read from all files
	*/
	int totallines();	

	/** Get total bytes read
		@author JDE
		@return the total number of bytes read from all files
	*/
	INT64 totalbytes();


	/** Turn on or off display all files
		@author JDE
		@param displayall true=display file progress relative all ALL files that match wildcard. false=display file progress relative to only the CURRENT file
	*/
	void displayallfiles(bool displayall);

	/** Turn on or off wildcard opening
		@author JDE
		@param b true=allow wildcard matching when opening/reading from files, 
		false=do not allow wildcard matching
	*/
	void allowwildcards(bool);

	/// flushes current file
	void flush();	
	
	operator FILE *() const;
	
	/** Reads a single line and splits it up into fields		
		@return Number of fields returned
		@param  argv  vector to place field address into 
		@param  maxargs  the maximum number of fields to return
		@author JDE
		@param  c  Charactor that divides fields
		@param  ebcdic  Is the data in EBCDIC or not
	*/
	int getargv(char **argv,int maxargs,char c,bool ebcdic=false);

	/// resets the file
	void reset();

	/** Is the file open?
		@author JDE
		@return true=file is currently open, false=file is not open
	*/
	bool isopen();

	/** Turn on or off flushing after every line
		@param flush On = true, Off = false
	*/
	void flusheachline(bool f);

	/** Is safe open on or off
		@return Seconds waited between retries
		@author ASE
	*/
	int get_safe(void);

	/** Turns safe file opening on or off and sets the number of seconds before retrying.
		Safe mode does not allow the file to be opened in write mode by any other program
		@author ASE
		@param  safe  number of seconds to wait between retries (0 disables safe mode)
	*/
	void set_safe(int safe);
	
	
	/** Sets the string that will be displayed as file is processed.
		@author JDE
		@param format String describing output
	*/
	void setprocessingstring(const char *format);

	/** extends string that will be displayed as file is processed
		@author JDE
		@param format String describing output to append to existing string
	*/
	void addtoprocessingstring(const char *format);

	/** Sets the string that will be displayed when file is done reading
		@author JDE
		@param  format String describing output
	*/
	void setcompletestring(const char *format);

	/** extends string that will be displayed when file is done reading
		@param format String describing output to append to existing string
		@author JDE
	*/
	void addtocompletestring(const char *format);

	/** Get string that describes processing output
		@return String representing output displayed while file is processing
		@author JDE
	*/
	const char *getprocessingstring();

	/** Get string that describes complete output
		@return String representing output displayed when file complete
		@author JDE
	*/
	const char *getcompletestring();

	/** Set the callback function for openening files
		@param callback Function to be called whenever another file is opened
		@author JDE
	*/
	void setcallback(void (*callback)(jdefile *));
	
	/** Set the compression type for the next file to be opened
		@param compression 	JDE_UNCOMPRESSED,JDE_BZIP2,JDE_NTFS_COMP,JDE_DEFAULT or JDE_GZIP
		@author ASE
	*/	
	void setcompression(JDE_FILE_COMPRESSION compression);

	/**	Turn magic compression detection on.
		When a file is opened for read jdefile can try to determine if it is compressed or not.
		This is done by looking at the "magic number" at the beginning of the file.
		If the file begins with { 0x42, 0x5A, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59 } it is 
		opened as a bzip2 file.
		@author ASE
	*/
	void magic_on(void);
	/** Turn magic compression detection off .
		@see magic_on
		@author ASE
	*/
	void magic_off(void);
//	int error(const char *data,const char *format,...);
//	void setdetailerrorfile(jdefile *detailerrorfile);
//	void setsummaryerrorfile(jdefile *summaryerrorfile);
//	void jdefile::printerrorlegend();
//	void jdefile::summarizeerrors();

	bool opennext();

#if _USE_TAR
	void tarfile(int on);
#endif

private:

	FILE *m_curfile;
#ifdef _BZLIB_H
	BZFILE *m_BZcurfile;
#endif
#ifdef ZLIB_H
	gzFile m_gzcurfile;
#endif

#ifdef _USE_TAR
	int m_tarred;
	int tar_open_next();
	int m_tar_file_read;
	int m_tar_file_size;
#endif

	FILE *m_filelist;
	int m_safe;
	int m_max_retries;
	int m_current_retries;
	int m_compression;
	bool safe_open(const char *name);

	char m_drivestr[_MAX_DRIVE];
	char m_pathstr[_MAX_DRIVE+

you posted the header file for bzlib.h but where is the source file? That header file is useless if you don't have the source file(s) or library that implement all those functions.

These functions are coded in one dll file libbz2.dll and i am using this dll in my project.

Did you recompile the DLL with that 64-bit compiler and add the *.lib to the project you made (you did make one didn't you???) for idefile.cpp

Ya i compiled in 64 bit and added in Project-> Properties -> Linker -> Input -> Additional Dependencies. I add only dll and i put only dll name like (libbz2.dll). Do i need to give fullpath. I am getting same error.

You are supposed to put the *.lib there, not the *.dll. When you created the DLL the compiler generated both the *.dll and *.lib files. The *.lib is the file your project has to link with, just like it does with all other system libs and DLLs.

This article has been dead for over six months. Start a new discussion instead.