All:
 
I am writing a routing and want to use type=memory files in C and this is what 
i tried...
 
 
  char buffer[80];
  char buffout[80];
  char lineout[121];
  int rctr;
  int wctr;
  fobj = fopen("file.data","w,type=memory");
  if(fobj != NULL)
      printf("FOBJ  File Open at: %s\n",time_of_day_now);
  rdr = fopen("DD:TEST1","r,blksize=80,recfm=f");
  if(rdr != NULL)
      printf("TEST1 File Open at: %s\n",time_of_day_now);
    while(fgets(buffer,80,rdr) != NULL)
      {
         rctr++;
         printf("rec %i %s\n",rctr,buffer);
         wctr++;
         memset(buffout,'',sizeof(buffout));
         strcpy(buffout,"\n");
         fwrite(buffout,1,80,fobj);
         wctr++;
      }
         fclose(rdr);
         fclose(fobj);
         printf("TEST1 File closed at: %s\n",time_of_day_now);
         printf("FOBJ  File closed at: %s\n",time_of_day_now);
         printf("TEST1 records read:    %i\n",rctr);
         printf("TEST1 records written: %i\n",wctr);
         rctr = 0;
         fobj = fopen("file.data","r,type=memory");
         memset(buffer,' ',sizeof(buffer));
         while(fread(buffer,80,1,fobj) == 1)
         {
            rctr++;
            printf("rec %i %s\n",rctr,buffer);
           if (feof(fobj))
             {
                  break;
             }
         }
         fclose(fobj);
} 

The fread is yielding no output just spaces ...so i must be misunderstanding 
something
Can someone be so kind as to shed some light on this for me ..

thanks

Scott J Ford
Software Engineer
http://www.identityforge.com/

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to