[osg-users] download file with .net plugin

Lilinx lilinx at 21cn.com
Tue Sep 11 03:53:03 PDT 2007


hi, all
    The platform: windows xp, vc 71 

	I want download file with .net plugin,and write to the disk before osgDB::readfile.
So I add some code :

            if( reader != 0L )
			{
//*******************************************************************************************
//add following code...
				std::string cacheFile = localCacheDir + '/' + fileName;
				osgDB::makeDirectoryForFile( cacheFile );
				std::ofstream fout(cacheFile.c_str());

				std::ios::pos_type pos = sio->tellg();
				char c;
				while(!sio->eof())
				{
					c = sio->peek();
					fout.put(c);
				}
				fout.flush();
				fout.close();
				sio->seekg(pos);
//*******************************************************************************************

                readResult = readFile(objectType, reader, *sio, local_opt.get() );
			}

but I find that the result is wrong. it is seen that some unwanted '0D' was writen into the file.
why?




More information about the osg-users mailing list