There are several other flaws in your code.

1. In Line 70 you create a memory leak. The string created in the expression is irrevertably lost.
2. The same is true for the string in the expression in line 72.
3. You have a vagabonding pointer in line 79. Always initialize your pointers!
4. You cannot pass a STRING* to a function that expects the type LPTSTR in line 83.
5. temp contains a random address and hence line 83 will overwrite random memory.
6. Line 84: temp is still not initialized so you can't pass it to str_to_int.
7. Problems 5 to 8 are also true for the next blocks of code.
8. Another two memory leaks in line 167 and 168.
9. The problem I already described above. You cannot have a file open and access it with the windows API at the same time as in line 176ff.

You should start simpler. Try to do a small example where a user can enter one line of text and write that to an ini file. If that works continue to expand your code.

Originally Posted By: Yashas
I had plans adding some extra code before WritePrivateProfileString ,hence I file_open n closed it.
Thats perfectly fine. Use the windows API to edit the ini file. Then open the file and manipulate it as you see fits. Just don't open the file WHILE using the Windows API. Remember to clear the cache before opening the file.

Originally Posted By: Yashas
I had started a post at MSDN Forum, replies wer that WritePrivateProfileString works only with 16bit Applications.
That's nonsense. It works perfectly fine with Lite-C.


Always learn from history, to be sure you make the same mistakes again...