Jump to content

ifstream


ErhanK
 Share

Recommended Posts

Hi. When i'm add the fstream header to my project, i'm getting this error : 'EOF': undeclared identifier. It's happens only in leadwerk project. Why is it?

I'm trying to parse a custom file like this code:

entityDef weapon_shotgun 
{
    "weapon_name"               "weapon_shotgun"
    "def_projectile"            "projectile_bullet_shotgun"
    "ammoType"                  "ammo_shells"
    "ammoRequired"              "1"
    "clipSize"                  "8"
    "mtr_flashShader"           "muzzleflash"
}

so i can generate my entities from it.

Capture2.PNG

Capture.PNG

Link to comment
Share on other sites

6 hours ago, reepblue said:

This is because EOF is conflicting with stream->EOF. What are you trying to do that the engine's stream class can't?

I'm trying to get it line by line with stop delimeter. I don't know if it exist in Stream class but simply i'm trying this..

ifstream myfile(filename);

if(myfile.is_open())
{
    string item;
    string name;
    string type;
    while(!myfile.eof())
    {
        getline(myfile,item,'|');
        
        getline(myfile,name,'|');
        while(getline(myfile,type,'|'))
        {
                cout<<type<<endl;
        }
        getline(myfile,type,'\n');
    }
    myfile.close();
}

Maybe i can do some extraction after stream->ReadLine()

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...