knowledge-database (beta)

Current group: comp.sources.bugs

Far pointer problem 2

Far pointer problem 2  
Narendra
From:Narendra
Subject:Far pointer problem 2
Date:30 Dec 2004 00:50:32 -0800
I have decalres 3 far pointer variable as
char far **result,**ftr7,**ftr6,**ftr5;

and

struct Image
{
char file[13];
unsigned long int weight;
}feature;

and

struct ffblk filelist;

and i have to allocate memory as a 2 dimensional array i.e of
result[n][13],Ftr[n][13]...... I used the following statement to
allocate memory,

if((result=farcalloc(n,sizeof(char far *))=NULL)
error, so exit;
for( i=0; i{
if((*(result+i)=farcalloc(13,sizeof(char far *))==NULL)
error, so exit;
while deallocating

for(i=0;ifarfree(*(result+i));
farfree(result);

like this i allocated memory for Ftr7,Ftr6,Ftr5;
after runnig program , the machine hangs.
I used farmalloc also instead of farcalloc, then also machine hangs,

other than above i used declaration i.e
char far result[5]][13],Ftr7[500][13],Ftr6[500][13],Ftr5[500][13]

some statements here,......
Now i have n structure information in feature structure,
now in my program i used the statement for string copy

for(i=0;i{
strcpy(result[i],feature.file);
strcpy(Ftr7[i],filelist.ff_name);
}

when i print here, only Ftr7 gets printed fine and result[i] shows some
garbage vale,
For the above printf statement i used %Fs, then also not working.

please , solve this problem.

*One more thing, do i need to use HIMEM.SYS, if so where to include
c:\windows\command\ebd\HIMEM.SYS

*do i need to run the program in pure MSDOS mode, does it works in
windows,
*Using far pointer what is the maximum no. of bytes we can allocate,
   

Copyright © 2006 knowledge-database   -   All rights reserved