The program is running fine, but it doesn't maintain lexical order of the string data elements on the screen and in the result file. And also, if I do not enter 2 strings after the file name (e.g linklist file.dat ) it got the memory error(0x0040347b, 0x000000") that cannot be read ...