About Store Forum Documentation Contact



Post Reply 
Reading a simple file
Author Message
Emtec Offline
Member

Post: #1
Reading a simple file
I have got a simple "data.txt" file in the editor. There are some information (human readable), values, which I need to read. I know that Esenthel has got FileText class but there is no methods which take UID. Sample code below what I mean:

FileText f;
f.read(UID(32719070, 1143450996, 3729907610, 913710329));

UID -> it is a data.txt file

To sum up I would like to read a simple file and then have got values from this files. Thanks.
(This post was last modified: 03-06-2014 04:02 PM by Emtec.)
03-06-2014 04:02 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #2
RE: Reading a simple file
f.readTry(EncodeFileName(UID(32719070, 1143450996, 3729907610, 913710329)));
03-06-2014 11:37 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Reading a simple file
03-07-2014 02:06 AM
Find all posts by this user Quote this message in a reply
Emtec Offline
Member

Post: #4
RE: Reading a simple file
I have got one more question why when I create in editor a raw file I can't open it to edit this file (add some values etc.). When I am clicking on this file anything is open to edit...?
03-09-2014 11:23 AM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #5
RE: Reading a simple file
I think the idea behind the Raw File is that its used as a mechanism to include file formats that are unrecognized by the engine ... so as such it wont have an inbuilt editor for these!
03-09-2014 01:19 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #6
RE: Reading a simple file
If you have a text file that you want to add as a raw file, create your text file and then add it to your project as Raw. If you want to edit that file manually, just edit the source file and then select the Raw element and do a "reload" for that element.
03-09-2014 03:02 PM
Find all posts by this user Quote this message in a reply
Emtec Offline
Member

Post: #7
RE: Reading a simple file
In EE_1.0 there has been a possibility to read a data from a file:

Example of file:

sunLight = 0.450, 0.300, 0.200
sunHighlight = 0.800

Example of code:

FileText f;
f.read(EncodeFileName(UID(18.., 12.., 36.., 12..)));
for( ; f.level() ; )
{
if(f.cur("sunLight"))
{
Vec tmpV=Sat(f.getVec());
}
else if(f.cur("sunHighlight"))
{
float tmpF=TextFlt(f.getValue());
}
}

Is in EE_2.0 possiblity to do that like in EE_1.0. The problem is with level() and cur() methods. Thanks.
(This post was last modified: 03-12-2014 10:24 PM by Emtec.)
03-12-2014 10:24 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
RE: Reading a simple file
Please use TextData, there's a tutorial included
03-12-2014 10:38 PM
Find all posts by this user Quote this message in a reply
Post Reply