How corectly to do it ? I can't find out :/
(C programing language + oslib)
----------------------------------------------
int folder_name_variable;
folder_name_variable = Brew;
Picture = oslLoadImageFile("Root/..folder_name_variable../test.png", OSL_IN_RAM, OSL_PF_5551);
[Solved] folder name as variable
[Solved] folder name as variable
Last edited by Pihas on Wed Jul 01, 2009 5:13 am, edited 2 times in total.
Cooming Soon
^That.
One of the first things you should learn is; what variables are and what they can do.
http://en.wikipedia.org/wiki/C_variable ... clarations
This might help.
One of the first things you should learn is; what variables are and what they can do.
http://en.wikipedia.org/wiki/C_variable ... clarations
This might help.
It's tough to see what you're trying to do. Is folder_name_variable really an integer, or should it be a string? What is the type of Brew?int folder_name_variable;
folder_name_variable = Brew;
Picture = oslLoadImageFile("Root/..folder_name_variable../test.png", OSL_IN_RAM, OSL_PF_5551);
The most confusing thing is whether or not you want the _name_ of the variable as a token in your string, or if you want the _contents_ of the variable in the string. In the former case, you're not going to be able to pull that off without some mightily obscure extension to your compiler unless you want to keep track of it somewhere else by yourself.
But even then, it doesn't make sense. How would you address the name of the variable? You'd logically need to know its name in advance anyway. I imagine the obscurity of it is a mitigating factor in ISO 9899's decision to not support that. :)
In the ladder case where you'd want the contents of the variable to show up in your string, you could use sprintf() to write a formatted string to a buffer and use that.
I think he's trying to do something like this:
Maybe... :/
Code: Select all
char* strfolder_path = "Brew";
/* No more than 80 characters in path */
char* strpath[80] = "Root/";
strcat(strpath, strfolder_path);
strcat(strpath, "/test.png");
Picture = oslLoadImageFile(strpath, OSL_IN_RAM, OSL_PF_5551);
Last edited by m0skit0 on Wed Jul 01, 2009 5:09 am, edited 1 time in total.
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
You're making things harder on yourself by trying to learn both the PSP and C at the same time. We recommend people learn C, THEN move on to programming the PSP. It's easier, and means less basic questions here. We don't teach C, so if your question is C related, you're more likely to get razzed than to get an answer.