jdeFopen Won't open file in AS400

hdavid89

Member
Hello All

I need to work with plain text files in AS400 using C++. According to documentation I read, i should use a parameter "r" in AS400 and "rb" or "rt" for Intel.

The problem is that the file never opens no matter what parameter is used.

I'm using the following code fragment:

#ifdef JDENV_AS400 /* The mode "r" applies to AS400 */
if((streamRead = jdeFopen((JCHAR *)lpDS->TXT0_PathOrigen, _J("r"))) == NULL )
#else
if((streamRead = jdeFopen((JCHAR *)lpDS->TXT0_PathOrigen, _J("rt"))) == NULL )
#endif
{
if( (streamRead = jdeFopen((JCHAR *)lpDS->TXT0_PathOrigen, _J("rb"))) == NULL )
{
jdeStrcpy((JCHAR *)zDSLog.szComment,(const JCHAR *) _J("CGCT"));
jdeStrcpy((JCHAR *)zDSLog.szString_1,(const JCHAR *) _J("File not Opened"));
idReturn = jdeCallObject( _J("WriteToJDELog") ,
(LPFNBHVR)NULL ,
lpBhvrCom ,
lpVoid ,
&zDSLog,
(CALLMAP*)NULL , 0 ,
(JCHAR*)NULL ,
(JCHAR*)NULL , 0 );

jdeFclose(streamRead);
jdeFclose(streamWrite);
free (streamRead);
free (streamWrite);



Thanks for your help in advance.
 
Back
Top