Title: Help: I am stuck with 'simple' file operation.
Can someone tell me why I can't read back the whole csv string that is written to a file?
Somehow my csv file is truncated during the read process. Just apply in an indicator to run this test.
Thanks for any help you can give!
herman
function PersistentVarSetTextExt( VarName, Ext, String )
{
global AmiBrokerPath;
fh = fopen( AmiBrokerPath+ VarName + Ext, "w" );
if ( fh )
{
fputs( String, fh );
fclose( fh );
}
return fh;
}
function PersistentVarGetTextExt( VarName, Ext )
{
global AmiBrokerPath;
fh = fopen( AmiBrokerPath+ VarName + Ext, "r" );
if ( fh )
{
String = fgets( fh );
fclose( fh );
}
else string = "";
return String;
}
AmiBrokerPath = "F:\\Program Files\\AmiBroker\\";
for( n=0, Str=""; n<1000; n++)
{
str = Str + "TESTING_"+NumToStr(n,1.0,False)+",";
}
StringCount = StrCount( Str, ","); // Count OK: 1000
PersistentVarSetTextExt( "Test", ".csv", Str );
SetStringCount = StrCount( Str, ","); // Count OK: 1000
Str = PersistentVarGetTextExt( "Test", ".csv" );
GetStringCount = StrCount( Str, ","); // COUNT WRONG: 93
Title =
"StringCount: "+ StringCount+"\n"+
"SetStringCount: "+ SetStringCount+"\n"+
"Get StringCount: "+ GetStringCount;
__._,_.___
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
__,_._,___
|