I am working on a project  that includes reading and writing of gif images. For opening the file i have simply called the method DGifOpenFile() which itself calls DGifOpenFileHandle() and DGifGetScreeanDesc() methods. After this method call when i call DGifGetRecordType() or any other method it gets stuck in an infinite loop as no error message is printed the process continues to be working, which requires manual interruption. I even tried accessing screen description components of GifFileType struct but the same thing happens.
  I have been trying to understand and sort this out for long, but could find no probable reason for this. My project is in C++.

Please help me solve and understand this problem. Looking forward to the reply.