Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Far pointer problem 2

0 views
Skip to first unread message

Narendra

unread,
Dec 30, 2004, 3:50:32 AM12/30/04
to
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<n; i++ )
{
if((*(result+i)=farcalloc(13,sizeof(char far *))==NULL)
error, so exit;
while deallocating

for(i=0;i<n;i++)
farfree(*(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<n;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,

0 new messages