Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Using file streams. Help please.  (Read 2633 times)

0 Members and 1 Guest are viewing this topic.

freesoul

  • Newbie
  • *
  • Posts: 19
    • View Profile
Using file streams. Help please.
« on: September 22, 2012, 09:37:55 pm »
Hello, I'm using SFML for a little project I have. But now I need to manage data in binary files, if I include <iostream> or <fstream> i get conflict with SFML libraries. So my questions are:

- What header is FileStream declared in? Is it flexible to manage data structures?

- If i want to keep using plain standard headers without any wrapper, how I can do it? Can I namespace a single section of code?

Sorry if any of these questions can sound stupid. Thanks for help

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Using file streams. Help please.
« Reply #1 on: September 22, 2012, 09:46:03 pm »
What is conflicting and how?
Back to C++ gamedev with SFML in May 2023

freesoul

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Using file streams. Help please.
« Reply #2 on: September 22, 2012, 11:34:07 pm »
I've made a test project to make a class to manage my data using io streams from <fstream> and <iostream>, paralelly to my main project which uses SFML libs.

As these libs were in a general debug sheet (sfml debug graphics, window ,..), they were included in my test project, and when I compiled, I got a hundred errors conflicting with standard stream headers.

I deleted these libs from my test project, and it compiled fine, the problem is I will need to include this data class to my main project whose SFML libraries I can't delete, obviously

What I am doing wrong? :S

What is conflicting and how?

What: SFML  +  <fstream> / <iostream>
How: that's part of what I want to know  ;D
« Last Edit: September 22, 2012, 11:44:10 pm by freesoul »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Using file streams. Help please.
« Reply #3 on: September 22, 2012, 11:50:17 pm »
Compiler and version, errors' texts, minimal code sample?
Back to C++ gamedev with SFML in May 2023

kaB00M

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Caffeware
    • Email
Re: Using file streams. Help please.
« Reply #4 on: September 23, 2012, 11:17:10 am »
i use streams with no problems.

using namespace std; //don't use
using std::cout; //use this instead; etc.
 



model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Re: Using file streams. Help please.
« Reply #5 on: September 23, 2012, 07:06:20 pm »
using namespace std;
That line was put in beginner tutorials by the devil himself, I am sure.  :(