SFML community forums
Help => System => Topic started by: Haikarainen 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.
-
Here you go mate, I think this will work.
https://legacy.sfmluploads.org/code/86
-
Here you go mate, I think this will work.
https://legacy.sfmluploads.org/code/86
does not
-
Could you please provide a complete and minimal source code that reproduces the problem, so that I can test and debug it?
-
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?
-
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.
-
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
-
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?
-
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