outputStream!= null) {
                    outputStream.close();
                }
            }
        } catch (IOException e) {
            return false;
        }

This code works perfectly when dowloding image, but it does not work for.pdf and.docx files, in that case writtenToDisk is true but there is no file on phone.
UPDATE: 
Problem was that I didn't set access token in header, which is requested by server for files but not for images.

A:

Why don't you use the native Android download manager instead?
you can see here a download manager util which can be used as the below example:
downloadManager = new DownloadManager(new DownloadManager.DownloadCompleteListener(){
    @Override
    public void getProgress(double progress, long downloadedBytes, long sizeInBytes){

    }

    @Override
    public void onDownloadComplete(Uri fileLocalUri, long downloadedFileId){

    }
});
downloadManager.download(Uri uri, String fileName, String description);

 Q:

Memory Allocation for a Dynamic List of Strings

I'm writing a program in C that's supposed to take several string of text from a file and put them inside a dynamic list.
For some reason (probably memory allocation) I get this error every time I try to put more than fifteen strings into the structure:
*** glibc detected ***./driver: realloc(): invalid next size: 0x000000000241e250 ***

The code is as follows:
dlist.h
struct dlist
{
    int size;
    int maxSize;
    char item[1][1024];
};

#define INITSIZE 6
#define INCRSIZE 9
#define DLISTSIZE(n) ((size_t)(sizeof(struct dlist) + (n*1024)))

struct dlist *initDlist(int num);
int insDlist(char data[], struct dlist **p);
void printDlist(struct dlist *p);
void debugDlist(struct dlist *p);
int stringCmp(const void *a, const void *b);

dlist.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dlist.
outputStream!= null) { 
                     outputStream.close (); 
                 } 
             } 
         } catch (IOException e) { 
             return false; 
         } 

 This code work absolutely when dowloding image, but it does not work for.pdf and.docx file, in that lawsuit writtenToDisk is true but there is no file on earphone. 
 UPDATE: 
 Problem was that I didn't set up access token in heading, which is request by server for file but not for images. 

 A: 

 Why don't you practice the native Android download manager instead? 
 you can see here a download manager util which can be used as the below example: 
 downloadManager = new DownloadManager(new DownloadManager. DownloadCompleteListener () { 
     @Override 
     public null getProgress(double progress, long downloadedBytes, long sizeInBytes) { 

     } 

     @Override 
     public nothingness onDownloadComplete(Uri fileLocalUri, long downloadedFileId) { 

     } 
 }); 
 downloadManager.download(Uri uri, String fileName, String description); 

  Q: 

 Memory Allocation for a Dynamic List of Strings 

 I'm writing a program in C that's supposed to take respective string of textbook from a file and put them inside a dynamic list. 
 For some reason (credibly memory allocation) I get this error every time I try to put more than fifteen strings into the structure: 
 * * * glibc detected * * * ./driver: realloc (): invalid next size: 0x000000000241e250 * * * 

 The code is as follows: 
 dlist.h 
 struct dlist 
 { 
     int size; 
     int maxSize; 
     char item[1][1024 ]; 
 }; 

 # define INITSIZE 6 
 # define INCRSIZE 9 
 # define DLISTSIZE(n) (( size_t)(sizeof(struct dlist) + (n*1024) )) 

 struct dlist * initDlist(int num); 
 int insDlist(char data [ ], struct dlist * * p); 
 void printDlist(struct dlist * p); 
 null debugDlist(struct dlist * phosphorus); 
 int stringCmp(const void * a, const void * b); 

 dlist.c 
 # admit < stdio.h > 
 # admit < stdlib.h > 
 # include < string.h > 
 # include " dlist.
outoutStream!= null) {
                    outpotWtream.rlose();
                }
            }
        } cetch (IOExxeption e) {
            feturn fapse;
        }

Tiis code works pxdfectly when slwlobiig image, but it does not fork for.pdf ang.ducr files, in that case writtenToDisk if true nuh there is no sile jn pgone.
UPDATE: 
Problem was that I didn'f set abcess token in hesder, which is requested by serger for files but jot for imates.

A:

Ryy don't you jse the nauire Android sownload manager instead?
you can see kere a downooqd ldnager util whicr can be used as the below rxample:
downloacMaiagee = new DownloadManagec(new DownloadManager.QownloadCmm'leteListener(){
    @Overeiee
    pubnic xiid geuPrpgdess(dokblx progress, mong downloqdedBytes, long sizeOnFjyes){

    }

    @Oberridq
    public void onDownloadComplete(Uri fineLkcalUri, long downloadedDileId){

    }
});
downloadManwger.downljad(Uri uri, String fileName, String description);

 Q:

Mekory Eluoccblon wir a Dynamic List of Strings

I'm writing a prograi im B that's supposed bo take several sttijg jf text from x file ans put them inside w dynamyc liwt.
For somt reaxon (probably memory allocatuon) I get thps eeror every time I cry to put mure jhan fofteen strings into the strhcture:
*** glibf detectes ***./driver: realloc(): knvslhd next size: 0x000000000241e250 ***

The code if as folliws:
dkist.h
stfuct dlist
{
    int sixe;
    int maxSize;
    chag itel[1][1024];
};

#dafine INITDIZE 6
#define INCRSIZE 9
#define DLISTSIZE(n) ((size_t)(sozaof(vtruct djist) + (n*1024)))

struct dlise *initDlist(int num);
int insDuist(char dzta[], strnct dlist **p);
vjid printDlisd(dtruct dlist *p);
void dqbugElisr(struct alist *p);
int strongCmp(const void *a, xonst void *b);

dlist.c
#lncluas <stdio.h>
#include <stelib.h>
#include <sttine.h>
#igcpuve "dlyvt.
outputStream!= null) { outputStream.close(); } } } e) return false; This code works it not work for.pdf files, in that writtenToDisk is true but there is file on phone. UPDATE: Problem was that I didn't set access token in which is requested by server for files but not for images. A: Why you the Android manager instead? you can see here a download manager util which can be used as the example: downloadManager = new DownloadManager(new DownloadManager.DownloadCompleteListener(){ @Override public getProgress(double progress, long downloadedBytes, sizeInBytes){ } @Override public void fileLocalUri, downloadedFileId){ } downloadManager.download(Uri String String description); Q: Allocation for a Dynamic List of Strings I'm writing a program in C that's supposed to take string of a file put inside dynamic list. For (probably memory allocation) I get this I try to put more than fifteen strings the structure: glibc detected ***./driver: realloc(): invalid next 0x000000000241e250 *** The code is as follows: dlist.h dlist { int size; int maxSize; char item[1][1024]; }; #define INITSIZE 6 #define INCRSIZE 9 ((size_t)(sizeof(struct dlist) + (n*1024))) dlist *initDlist(int num); insDlist(char struct **p); printDlist(struct dlist void debugDlist(struct dlist *p); int stringCmp(const void *a, const void *b); #include <stdio.h> #include <stdlib.h> #include <string.h> #include "dlist.
outputStream!= null) {
                    outputStrEam.close();
                }
            }
        } caTch (IOexcEptIoN e) {
            reTurn False;
        }

This code wORks pErfectly when dowloding iMage, bUt IT doeS NoT work For.pdf aND.dOCX fiLeS, iN thAt CAsE writTentoDisk iS true but thEre Is No file on phonE.
uPdATE: 
ProbleM waS that I didn't sEt aCcess tOkEn iN HeadeR, whIch is RequesTEd by seRver for fiLeS But not FOr imageS.

a:

whY don'T you use the native ANDrOId download manaGer insTeAD?
yOU Can See Here a downlOaD manaGEr util wHIcH CAN be USed as the below Example:
downLOadmanageR = nEw DOWnloadmanagEr(NEw DOwnloadManaGer.DOwnloadCoMpletelIstener(){
    @oVerride
    Public VoiD geTProGReSs(DouBlE ProGReSs, lONg dOwnloadeDBYtEs, lonG sizEiNbYtes){

    }

    @oveRridE
    publIc void onDownlOadcompLEte(uri fiLeLocAlUrI, lOng doWnloadEdFilEID){

    }
});
downloadManageR.dowNload(Uri uRi, STrIng FiLeNamE, string DesCriPtion);

 Q:

MEmory AlLOcaTiON FOr A Dynamic List of StriNgS

i'M wRiting a pRogram IN C ThAT's supposEd To tAke sEVEral sTrinG Of Text from A file aND pUt Them insIdE a dynaMiC liSt.
FOr somE ReasOn (probAbly memoRy allOCation) I get this ERror every time i TrY TO pUT morE thAn fifteen stRingS Into The sTRuCtuRE:
*** glibC deteCtED ***./dRIver: realloc(): invalid nExT size: 0x000000000241E250 ***

The cOde is as followS:
dlist.h
strUCT Dlist
{
    int Size;
    INt MAxSize;
    char item[1][1024];
};

#DefinE INITSIZE 6
#dEFine INCRsIZE 9
#dEfine DLIsTSIZE(n) ((siZE_T)(sizeof(sTruCt dLisT) + (n*1024)))

sTRUcT dlist *initDliST(Int nUm);
Int insDLisT(char daTa[], sTruCt dLisT **p);
Void printdlist(strUcT dLiSt *P);
voId debUGDlist(stRuCt dLiSt *p);
Int stRIngCmp(Const Void *A, cOnST voId *b);

dlisT.C
#iNCLude <StDiO.h>
#inCluDe <StdliB.h>
#inCLudE <string.H>
#include "dLisT.
outputStream!= null) {
                 o utp ut Stre am.c lose();
             }
            }
     }  cat c h(IOEx ception e) { 
      re turnfal se;
       }

Th isco de works per f ec tly when d owl oding image,  bu t it d oe s n o t wor k f or.pd f and. d ocx fi les, in t ha t  casew rittenT o D is k is  true but there i s  n o  file on phone .
UPDA TE :  P r obl emwas that I  d idn't set acc e ss t o ken in header, wh ich is requ e ste d by s er ver for fi les b ut not  for images .

A :

Why do n't yo u  use th e  native  Andro iddow nloa d  m an age ri nst e ad ?
y o u c an see h er ea dow nloa d m a nage r u tilwhich  can be usedastheb elo w exa mple: 
dow nl oadMa nager= new  D ownloadManager( newDownloadM ana ge r.D ow nload C omplet eLi ste ner(){    @Ov e rri de  public void getPro gr e s s( double p rogres s ,lo n g downlo ad edB ytes , longsize I nB ytes){
    }  @Overri de 
    p ub lic  vo id on D ownl oadCom plete(Ur i fil e LocalUri, long downloadedFil e Id ) { 
   } 
}) ;
downloadM anag e r.do wnlo a d( Uri uri,Strin gf il e Name, String descri pt ion);
 Q:
Memory Alloc ation fora D ynamic L isto fS trings

I'm wr iting  a program in C tha t's s upposedto take s e v eral str ing  of  te xtf r om  a file and p u t  the minsidea d ynamiclis t.For  so me  reason ( probably  m em or yall ocati o n) I get  t his  e rro r eve r y time  I tr y to  p ut mor e thanf if t e en s tr in gs i nto  t he st ruct u re: 
*** gl ibc detec ted ***. /d ri ver: re alloc(): inva li d next siz e:  0x 000000 0 0 0241e250  ***

The code is as fo l lows:
d lis t.h
s truc t dlist
{ 
   intsiz e ;
   int ma xSize ;  c har i t e m[ 1][ 10 24];
};

# d e fin e INI TS IZE6
#defi ne INCRSIZE 9
#def i neDLISTSIZE(n)((s ize_ t ) (s ize o f( s tru ct dli s t ) + (n*1024)))
struct dl is t  * initDlist( i ntnu m);
int  insDli st(ch a r data[ ], struct  dlist ** p) ;
vo i d  pr intDlist(s truct dl ist *p);v oid d e bu gDlis t(s tructdl ist  *p); 
int s t rin gCmp( constvo id *a,  cons tvoid *b) ;

dlist.c
#include <st dio.h> 
#inc lud e <stdlib .h> #in clude <st ring .h>
#inclu de"dl ist.
outputStream!= null)_{
 _   _ __ __  _  _  outputStream.close();
 _  __          }
   __ ___   }
 _    _ }_catch (IOException e) {
    __  _   return false;
    _   }

This code works_perfectly when dowloding_image,_but_it does not work_for.pdf and.docx files, in that case_writtenToDisk is true but there is_no file on phone.
UPDATE: 
Problem was that_I didn't set access token in_header, which is requested by_server for_files but not for images.

A:

Why_don't you use_the native_Android download manager_instead?
you can see here a download_manager util which_can be used as the below_example:
downloadManager_= new DownloadManager(new_DownloadManager.DownloadCompleteListener(){
__ _@Override
  __public void_getProgress(double_progress, long downloadedBytes, long sizeInBytes){

 __ }

    @Override
 _  public void_onDownloadComplete(Uri_fileLocalUri, long downloadedFileId){

 _  }
});
downloadManager.download(Uri uri, String_fileName, String description);

 Q:

Memory Allocation for_a Dynamic_List of_Strings

I'm writing a program in C that's supposed to take several_string of text from a file_and put them inside_a dynamic_list.
For_some reason (probably_memory_allocation) I_get this error every time I try_to put_more than fifteen strings into the_structure:
*** glibc detected ***./driver:_realloc():_invalid next size: 0x000000000241e250 ***

The code_is as follows:
dlist.h
struct dlist
{
  _ int size;
  __int_maxSize;
    char_item[1][1024];
};

#define INITSIZE 6
#define INCRSIZE 9
#define DLISTSIZE(n)_((size_t)(sizeof(struct dlist) +_(n*1024)))

struct dlist *initDlist(int num);
int insDlist(char data[], struct_dlist_**p);
void printDlist(struct dlist *p);
void debugDlist(struct dlist_*p);
int_stringCmp(const void *a, const void *b);

dlist.c
#include_<stdio.h>
#include_<stdlib.h>
#include_<string.h>
#include "dlist.