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

Author Topic: sf::InputStream newb question  (Read 4170 times)

0 Members and 1 Guest are viewing this topic.

Haikarainen

  • Guest
sf::InputStream newb question
« on: September 08, 2011, 10:33:24 pm »
Hello, trying to create an InputStream to be able to load files directly from my custom packaging format, but i get a segmentation fault on the Read function.

EDIT; Well what i really wanted to ask what; What is the basic principles of getting sometihng like this to work ? :D

Warning: I have no or very little knowledge of what I am actually doing here, but here goes the sourcecode;

Cpp;
https://legacy.sfmluploads.org/code/82

Hpp;
https://legacy.sfmluploads.org/code/83

my::Data::File::GetContents() returns a char* containing  raw filedata.

coolhome

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: sf::InputStream newb question
« Reply #1 on: September 09, 2011, 02:01:54 am »
Here you go mate, I think this will work.

https://legacy.sfmluploads.org/code/86
CoderZilla - Everything Programming

Haikarainen

  • Guest
Re: sf::InputStream newb question
« Reply #2 on: September 09, 2011, 03:41:29 am »
Quote from: "coolhome"
Here you go mate, I think this will work.

https://legacy.sfmluploads.org/code/86

does not

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::InputStream newb question
« Reply #3 on: September 09, 2011, 07:44:39 am »
Could you please provide a complete and minimal source code that reproduces the problem, so that I can test and debug it?
Laurent Gomila - SFML developer

Haikarainen

  • Guest
sf::InputStream newb question
« Reply #4 on: September 09, 2011, 11:35:19 am »
Quote from: "Laurent"
Could you please provide a complete and minimal source code that reproduces the problem, so that I can test and debug it?


No, since i do not know how to do it :O Thats kinda the problem, or is the code right?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::InputStream newb question
« Reply #5 on: September 09, 2011, 12:25:58 pm »
Quote
No, since i do not know how to do it

You don't know how to reduce your code? It looks simple: provide your InputStream class, and a main that uses it to load a resource. Replace your Data::File class with a std::vector<char>, for example.
Laurent Gomila - SFML developer

Haikarainen

  • Guest
sf::InputStream newb question
« Reply #6 on: September 09, 2011, 04:05:50 pm »
Quote from: "Laurent"
You don't know how to reduce your code? It looks simple: provide your InputStream class, and a main that uses it to load a resource. Replace your Data::File class with a std::vector<char>, for example.


I didn't know how to write the functions properly, however i made it work just now. Apparently one of my functions was broken, stupid mistake :P

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::InputStream newb question
« Reply #7 on: September 09, 2011, 04:08:42 pm »
Quote
I didn't know how to write the functions properly, however i made it work just now. Apparently one of my functions was broken, stupid mistake

Was it a mistake in my::Data::Stream (in this case I'd like to see the fix) or somewhere else in your code?
Laurent Gomila - SFML developer

Haikarainen

  • Guest
sf::InputStream newb question
« Reply #8 on: September 09, 2011, 04:58:33 pm »
Quote from: "Laurent"
Was it a mistake in my::Data::Stream (in this case I'd like to see the fix) or somewhere else in your code?


Somewhere else in my code, my::Data::Package::GetFile returned empty pointers for some reason :S created a my::Data::Package::GetStream instead and now it works fine!

The code that I went with:http:// https://legacy.sfmluploads.org/code/88

 

anything