Loading Problem
-
HI Guys, i am using the CStdioFile ReadString() Function to read several files with the size of 350KB per File. Sometimes it takes to long to load the files and sometimes my app crashes. Is there any solution to save loading time ??? maybe any other function ? Best Regards Sonu
-
HI Guys, i am using the CStdioFile ReadString() Function to read several files with the size of 350KB per File. Sometimes it takes to long to load the files and sometimes my app crashes. Is there any solution to save loading time ??? maybe any other function ? Best Regards Sonu
...and sometimes my app crashes. Is there any solution to save loading time ??? Your app crashing is a very likely sign that you've got a bug in your code --this may have to do with the poor performance you're obtaining, also. Could you post the piece of code in which you're using
ReadString
? This would help determine what's going on. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo -
...and sometimes my app crashes. Is there any solution to save loading time ??? Your app crashing is a very likely sign that you've got a bug in your code --this may have to do with the poor performance you're obtaining, also. Could you post the piece of code in which you're using
ReadString
? This would help determine what's going on. Joaquín M López Muñoz Telefónica, Investigación y DesarrolloMy app only crashes cause the files which i am loading are to large. If i try this with smaller files, everything works fine. So i need a solution for the loading Problem. strFile is just a csv file with the size of 350KB. CString sRow; CStdioFile inFile(strFileName, CFile::modeRead); while(inFile.ReadString(sRow) != FALSE) { // loading the String in a ListCtrl } inFile.Close(); you see i am not doing very much Best Regards Sonu
-
My app only crashes cause the files which i am loading are to large. If i try this with smaller files, everything works fine. So i need a solution for the loading Problem. strFile is just a csv file with the size of 350KB. CString sRow; CStdioFile inFile(strFileName, CFile::modeRead); while(inFile.ReadString(sRow) != FALSE) { // loading the String in a ListCtrl } inFile.Close(); you see i am not doing very much Best Regards Sonu
-
My app only crashes cause the files which i am loading are to large. If i try this with smaller files, everything works fine. So i need a solution for the loading Problem. strFile is just a csv file with the size of 350KB. CString sRow; CStdioFile inFile(strFileName, CFile::modeRead); while(inFile.ReadString(sRow) != FALSE) { // loading the String in a ListCtrl } inFile.Close(); you see i am not doing very much Best Regards Sonu
350 kb is surely not large enough to cause a crash. It must be something in your code. Carefully go through it step by step. Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
-
350 kb is surely not large enough to cause a crash. It must be something in your code. Carefully go through it step by step. Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
I know. I tryed the same with smaller files and everything works fine. NO CRASH Best Regards Sonu
-
My app only crashes cause the files which i am loading are to large. If i try this with smaller files, everything works fine. So i need a solution for the loading Problem. strFile is just a csv file with the size of 350KB. CString sRow; CStdioFile inFile(strFileName, CFile::modeRead); while(inFile.ReadString(sRow) != FALSE) { // loading the String in a ListCtrl } inFile.Close(); you see i am not doing very much Best Regards Sonu
I don't think
CStdioFile
is having anything to do with the slowness of your code (you can verify this commenting out the code inside the loop and seeing if the app still goes slow). More probably it is the process of populating theCListCtrl
that is causing your app to go slowmo. You can do two things to accelerate this process:-
Rick York pointed out an interesting idea in a previous thread today that applies to your case. Use
WM_SETREDRAW
to prevent redrawing while you fill the list:list.SendMessage(WM_SETREDRAW,(WPARAM)FALSE,0);
while(...){
...
}
list.SendMessage(WM_SETREDRAW,(WPARAM)TRUE,0); -
Make sure the styles
LVS_SORTASCENDING
andLVS_SORTDESCENDING
are note set for the list control, to prevent sorting in the middle of the population process. Later, you can sort the data (if this is your wish) withCListCtl::SortItems
.
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
-
I don't think
CStdioFile
is having anything to do with the slowness of your code (you can verify this commenting out the code inside the loop and seeing if the app still goes slow). More probably it is the process of populating theCListCtrl
that is causing your app to go slowmo. You can do two things to accelerate this process:-
Rick York pointed out an interesting idea in a previous thread today that applies to your case. Use
WM_SETREDRAW
to prevent redrawing while you fill the list:list.SendMessage(WM_SETREDRAW,(WPARAM)FALSE,0);
while(...){
...
}
list.SendMessage(WM_SETREDRAW,(WPARAM)TRUE,0); -
Make sure the styles
LVS_SORTASCENDING
andLVS_SORTDESCENDING
are note set for the list control, to prevent sorting in the middle of the population process. Later, you can sort the data (if this is your wish) withCListCtl::SortItems
.
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
Thanx I will try this. Maybe this can solve my Prob. Best Regards Sonu
-