What's BB used to load txt files?

(5 posts) (4 voices)

Tags:

No tags yet.

  1. Jeeva3m

    veteran
    Joined: Dec '14
    Posts: 131

    Hi friends,

    What BB can be used to load text files (.txt) to studio. Can we use "Load Asset BB" or any other?

    thanks
    jeeva

    Posted 2 years ago #
  2. hiddentux

    3D Experience Guru
    Joined: Feb '09
    Posts: 400

    Hi,

    Yes you can, it's basically the same thing than for any other external file, except this time you need to cast the vkTextResource into a vkString.

    Posted 2 years ago #
  3. Jeeva3m

    veteran
    Joined: Dec '14
    Posts: 131

    thank you hiddentux for your valuable share

    Posted 2 years ago #
  4. sunder3dvia

    veteran
    Joined: Dec '14
    Posts: 278

    Hi Jeeva,

    vkURI path;
    	path.Create("Plelase specify the text file path here");
    
    	vkAssetPtr asset;
    	vkArray<vkResourcePtr> res;
    	vkString content,subStr;
    
    	err = GetStage().LoadAsset(path,res,&asset,true,true);
    
    	if(err==errOk)
    	{
    		vkString delimeter[3];
    		delimeter[0] = "\r\n";
    		delimeter[1] = "\r";
    		delimeter[2] = "\n";
    
    		vkTextResourcePtr text = res[0];
    		Print(text.m_Text.Length());
    		content = text.m_Text;
    
    		Print("------- CONTENT OF THE TEXT ---------");
    
    		vkString::Iterator itStart = content.Begin();
    		vkString::Iterator it = content.Find('\n');
    
    		while(it!=content.End())
    		{
    			vkString out = content.SubString(itStart,it);
    			itStart = it++;
    			it = content.Find('\n',itStart);
    			Print(out);
    		}

    Try to implement this code.

    Posted 2 years ago #
  5. iainB85

    Interplanetary Delivery Boy
    Joined: Jun '08
    Posts: 515

    You can have a look at this sample too: http://www.3dvia.com/content/91C86E8799ABBD8F/load-local-text-file

    Posted 2 years ago #

Reply

You must log in to post.