Zeige Ergebnis 8.311 bis 8.340 von 10174
C/C++ Programming Help Thread
This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; ...
-
03-28-2008, 06:34 PM #8311QJ Gamer Blue
- Registriert seit
- Jul 2006
- Beiträge
- 132
- Points
- 4.296
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Code:/*****************************************************\ Auteur : Foury Jean-francois Auteur de : Super Mario toy Jour 10 collision entre 1 sprite et une map \*****************************************************/ //La librairie principale OSLib #include <oslib/oslib.h> #include "collisions.h" #include "sprite.h" //les callbacks PSP_MODULE_INFO("OSLib Sample", 0, 1, 1); PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); //definition des pointeurs vers notre map OSL_MAP *Map01, *Map_collision; OSL_IMAGE *Map01_tileset, *collision_tileset; #define TILE_NOSOLID 0 #define TILE_SOLID 1 OSL_IMAGE *Joueur ; //fonctions void Touches(); void AnimMarche(); void Gestion_Map(); short GetTile(OSL_MAP *m,int col, int row); int oslCollisionMap(OSL_MAP *m,OSL_IMAGE *sprite,int haut,int bas, int gauche, int droit); /* ==================== colision Verifie si il y a une colision entre 2 sprites ==================== */ int main() { //Initialisation de la librairie oslInit(0); //Initialisation du mode graphique oslInitGfx(OSL_PF_8888, 1); //chargement de nos images (oui, le "loading" :p) Map01_tileset = oslLoadImageFile("sprite_s.png", OSL_IN_RAM, OSL_PF_5551); collision_tileset = oslLoadImageFile("collisions_s.png", OSL_IN_RAM, OSL_PF_5551); Joueur= oslLoadImageFile("player.png", OSL_IN_RAM, OSL_PF_5551); //place Le joueur vers le centre de l'écran et dans sa position de départ Joueur->x = 240; Joueur->y = 130; Gestion_Map(); //Initialisation des map //boucle principale while (!osl_quit) { //Permet de dessiner oslStartDrawing(); //check des touches Touches(); //Affiche la map concerner, mais n'affiche pas la map des collision oslDrawMapSimple(Map01); //dessine nos sprite oslDrawImage(Joueur); //Fin du dessin oslEndDrawing(); //Synchronise l'écran oslSyncFrame(); } //on quitte l'application oslEndGfx(); oslQuit(); return 0; } /* ==================== Touches Gestion des touches pour le jeux :) ==================== */ void Touches() { //Lit les touches oslReadKeys(); if (osl_keys->held.down) { if (!oslCollisionMap(Map_collision,Joueur,0,1,0,0)) { //ok on bouge Joueur->y += 2; } } if (osl_keys->held.up) { if (!oslCollisionMap(Map_collision,Joueur,1,0,0,0)) { Joueur->y -= 2; } } if (osl_keys->held.left) { if (!oslCollisionMap(Map_collision,Joueur,0,0,1,0)) { Joueur->x -= 2; } } if (osl_keys->held.right) { if (!oslCollisionMap(Map_collision,Joueur,0,0,0,1)) { Joueur->x += 2; } } } /* ==================== Gestion_Map() Initialilsation des map ==================== */ void Gestion_Map() { //configuration de la map Map01= oslCreateMap( Map01_tileset, //Tileset (void *)sprite_map, //Map 16,16, //Taille des tiles 30,17, //Taille de la Map OSL_MF_U16); //Format de la Map //configuration de la map Map_collision= oslCreateMap( collision_tileset, //Tileset (void *)collisions_map, //Map 16,16, //Taille des tiles 30,17, //Taille de la Map OSL_MF_U16); //Format de la Map } /* ==================== GetTile Retourne sur quel sprite le player et possitionner ==================== */ short GetTile(OSL_MAP *m,int col, int row) { u16 *map = (u16*)m->map; return map[row*m->mapSizeX + col]; } /* ==================== oslCollisionMap Gestion des collisions avec les map et les perso pour le RPG ==================== */ int oslCollisionMap(OSL_MAP *m,OSL_IMAGE *Collision,int haut,int bas, int gauche, int droit) { int tile; //Test de collition pour la partie Demander suivant la touche appuyer haut, bas, gauche, droit. if (haut) { tile = GetTile(m,((m->scrollX + Collision->x +Collision->stretchX ))/ m->tileX, (m->scrollY + Collision->y - 2)/ m->tileY); if (!tile) { tile = GetTile(m,((m->scrollX + Collision->x))/ m->tileX, (m->scrollY + Collision->y - 2)/ m->tileY); //essaye avec la moitier du personnage pour que la tete passe quoi qu'il arrive } } if (bas) { tile = GetTile(m,((m->scrollX + Collision->x +Collision->stretchX ))/ m->tileX, (m->scrollY + Collision->y + Collision->stretchY + 2)/ m->tileY); if (!tile) { tile = GetTile(m,((m->scrollX + Collision->x))/ m->tileX, (m->scrollY + Collision->y + Collision->stretchY + 2)/ m->tileY); } } if (gauche) { tile = GetTile(m,((m->scrollX + Collision->x - 2))/ m->tileX, (m->scrollY + Collision->y + Collision->stretchY)/ m->tileY); if (!tile) { tile = GetTile(m,((m->scrollX + Collision->x - 2))/ m->tileX, (m->scrollY + Collision->y)/ m->tileY); } } if (droit) { tile = GetTile(m,((m->scrollX + Collision->x +Collision->stretchX + 2))/ m->tileX, (m->scrollY + Collision->y + Collision->stretchY)/ m->tileY); if (!tile) { tile = GetTile(m,((m->scrollX + Collision->x +Collision->stretchX + 2))/ m->tileX, (m->scrollY + Collision->y)/ m->tileY); } } switch(tile) { case TILE_NOSOLID: // pas de collision sur le sprite retourne donc 0 return 0; break; case TILE_SOLID: // impassable retourne simplement 1 car impossable return 1; break; //On peut rajouter autant de case que besoin celon ce que on recherche. } return 0; }
[IMG]http://pjeffadsl.free.fr/docs2/output/tut2_screen3.png[****]
what i am haveing trouble figuring out is how he used this image to make the whole map? i dont get it, how you can use 1 image and make duplicates.
[IMG]http:/****206.imageshack.us**** 206/5092/spritesyl1.png[****]
also what do this image have anything to do with collision? like how does this work.
[IMG]http:/****518.imageshack.us**** 518/2122/collisionsskf7.png[****]
ya so im just wondering how he creates the whole map with those 2 sprites(like what part of the code and how) and what the second images has anything to do with collision.
Geändert von cruisx (03-29-2008 um 09:02 AM Uhr)
-
03-29-2008, 06:23 AM #8312QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Any ideas?
Zitat von Xsjado7
-
03-29-2008, 12:06 PM #8313
- Registriert seit
- Mar 2008
- Beiträge
- 2
- Points
- 2.590
- Level
- 30
- Downloads
- 0
- Uploads
- 0
how difficult would it be to execute the official sony music player within a homebrew using an execute function?
-
03-29-2008, 12:22 PM #8314I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Well, you'd have to find what modules were required, then which partitions to load them in, then how to load them (I.E. what arguments were needed).
All in all, pretty hard, because I'm guessing you'd have to do it yourself as I don't think anyone else has done it. Still, be an interesting thing to work on.
-Aura
-
03-29-2008, 08:33 PM #8315QJ Gamer Blue
- Registriert seit
- Jul 2006
- Beiträge
- 132
- Points
- 4.296
- Level
- 41
- Downloads
- 0
- Uploads
- 0
ok i need some help guys. I am trying to lean how to do collision detection with 2 objects on the screen but i am kinda stuck, im sure the problem is an easy one, but for a beginner i am having some trouble.
I know where the problem is but i dont know what im doing wrongCode://Oslib header file #include <oslib/oslib.h> //This is needed for eboot PSP_MODULE_INFO("OSLib Sample", 0, 1, 1); PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); //this creates pointers for our images. OSL_IMAGE *sprite, *sprite2, *sprite3; //definations #define DOWN 0 #define UP 35 #define RIGHT 70 #define LEFT 105 //variables int sprite_position; int sprite_march; //declare the function like buttons and spriteAnimation void Buttons(); void SpriteAnimate(); int collision(OSL_IMAGE *img1,float img1posX, float img1posY, OSL_IMAGE *img2, float img2posX, float img2posY,OSL_IMAGE *img3, float img3posX, float img3posY ); int main() { //start the Oslib library oslInit(0); //start the graphixs mode oslInitGfx(OSL_PF_8888, 1); //sets the transparency color oslSetTransparentColor(RGB(255,0,255)); //loads the images into memory sprite = oslLoadImageFile("sprite.png", OSL_IN_RAM, OSL_PF_5551); sprite2 = oslLoadImageFile("sprite2.png", OSL_IN_RAM, OSL_PF_5551); sprite3 = oslLoadImageFile("sprite3.png", OSL_IN_RAM, OSL_PF_5551); //Disables the transparent color so it cannot be used again oslDisableTransparentColor(); //sees if all files are avaiable if (!sprite || !sprite2||!sprite3) oslDebug("! one or more of the files were missing, the program cannot run"); //Sets the sprites original position, lets see if i can get 2 sprites on da bloody screen sprite->x = 155; sprite->y = 95; sprite_position = DOWN; //sets second sprite position sprite2->x = 230; sprite2->y = 130; //sets thrid sprite pos sprite3->x = 270; sprite3->y = 130; //main while loop while (!osl_quit) { //to be able ot draw on the screen oslStartDrawing(); //Buttons Buttons(); //draws a green background oslDrawGradientRect(0,0,480,272,RGB(0,128,0),RGB(0,128,0), RGB(128,255,128), RGB(128,255,128)); //this draws the images to the screen oslDrawImage(sprite); oslDrawImage(sprite2); oslDrawImage(sprite3); //stops the drawing mode oslEndDrawing(); //sync the screen oslSyncFrame(); } //terminate the program oslEndGfx(); oslQuit(); return 0; } void Buttons() { //starts up the psp buttons oslReadKeys(); if (osl_keys->held.down) { if(!collision(sprite, sprite->x, sprite->y + 2, sprite2, sprite2->x, sprite2->y, sprite3, sprite3->x, sprite3->y )) { //sprite movement sprite->y +=2; //sets sprite position on sprite sheet sprite_position = DOWN; //calls sprie animate SpriteAnimate(); } } if (osl_keys->held.up) { if(!collision(sprite, sprite->x, sprite->y - 2, sprite2, sprite2->x, sprite2->y,sprite3, sprite3->x, sprite3->y )) { sprite->y-= 2; sprite_position = UP; SpriteAnimate(); } } if (osl_keys->held.right) { if(!collision(sprite, sprite->x + 2, sprite->y, sprite2, sprite2->x, sprite2->y,sprite3, sprite3->x, sprite3->y )) { sprite->x += 2; sprite_position = RIGHT; SpriteAnimate(); } } if (osl_keys->held.left) { if(!collision(sprite, sprite->x - 2, sprite->y, sprite2, sprite2->x, sprite2->y,sprite3, sprite3->x, sprite3->y )) { sprite->x -= 2; sprite_position = LEFT; SpriteAnimate(); } } //If a button is not pressed if (!osl_keys->held.value) { //Start the variable over for when a button is pressed again sprite_march = 0; //Sets the sprite's direction oslSetImageTileSize(sprite,0,sprite_position,22,35); } } void SpriteAnimate() { //Moves the sprite in the row that it is in sprite_march++; //Moves the sprite constantly oslSetImageTileSize(sprite,(sprite_march * 22),sprite_position,22,35); //resets the sprite movement in that row if (sprite_march == 6) sprite_march = 0; } int collision(OSL_IMAGE *img1,float img1posX, float img1posY, OSL_IMAGE *img2, float img2posX, float img2posY, OSL_IMAGE *img3, float img3posX, float img3posY ) { int collision; collision = 0; float img1width = img1->stretchX; float img1height = img1->stretchY; float img2width = img2->stretchX; float img2height = img2->stretchY; float img3width = img3->stretchX; float img3height = img3->stretchY; if ((img1posX + img1width > img2posX) && (img1posX < img2posX + img2width) && (img1posX + img1width > img3posX) && (img1posX < img2posX + img3width) && (img1posY + img1height > img2posY) && (img1posY < img2posY + img2height) ) { collision = 1; } return collision; }
Code:if ((img1posX + img1width > img2posX) && (img1posX < img2posX + img2width) && (img1posX + img1width > img3posX) && (img1posX < img2posX + img3width) && (img1posY + img1height > img2posY) && (img1posY < img2posY + img2height) ) {
if i put that in, none of the sprites have collision but if i take out the Bolded parts the first sprite has collision but the second one dose not.(second sprite as in the second object, not the character that is moving). How do i modify this correctly for every new object on the screen? help will be greatly appreciated.Geändert von cruisx (03-30-2008 um 08:21 AM Uhr)
-
03-30-2008, 06:39 AM #8316QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Could someone please tell me what the hell is going on?
Spoiler for Compiler Errors:
Lines *supposedly* containing errors:
Spoiler for Lines:
Score struct:
Spoiler for Score struct:
Player struct:
Spoiler for Player struct:
-
03-30-2008, 06:43 AM #8317Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
You can't assign them like you are.
Use strcpy(), sprintf() or similar.
Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
03-30-2008, 06:51 AM #8318QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
sprintf...could i get any dumber...
I thought coders are usually at their peak at 2 in the morning
Thanks IWN :)
-
03-30-2008, 05:31 PM #8319QJ Gamer Bronze
- Registriert seit
- Jan 2007
- Ort
- Right here
- Beiträge
- 179
- Points
- 5.354
- Level
- 47
- Downloads
- 0
- Uploads
- 0
it's not as easy as you think. the hardware ME decoder can be initialized by
Zitat von midnight_rush
but this is only for the initialization of the decoder. you still have to manually read the mp3 data from the file.Code:sceUtilityLoadAvModule(PSP_AV_MODULE_AVCODEC);
sudo rm -rf /
PSN ID: FigMan13
-
03-30-2008, 05:38 PM #8320
Hi. I started using OSLib today, and I wanted to know a way of having collision with something that is a more of an odd shape or Diagonal Boxes and not a Squarish look shape(Flat Box,Flat Platform)?
Free Prizes at Prizerebel Join us!
I already got 11 Gifts. Ask me for details or proof.
-
03-31-2008, 01:21 AM #8321QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Use Object Orientated Bounding Box (OOBB) Collision or Line Box collision tests.
Zitat von ZereoX
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
03-31-2008, 01:39 AM #8322QJ Gamer Bronze

- Registriert seit
- Sep 2006
- Ort
- france
- Beiträge
- 170
- Points
- 6.359
- Level
- 52
- Downloads
- 0
- Uploads
- 0
-
03-31-2008, 04:43 AM #8323
Like a said I'm still a newbie. So could you show me an example?
Free Prizes at Prizerebel Join us!
I already got 11 Gifts. Ask me for details or proof.
-
03-31-2008, 09:08 AM #8324QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Say i had something like:
how would i go about copying "score 2" into another string? strcpy doesnt let you set the params for where to copy to and fromCode:char str[32]; sprintf(str, "score 1 = 10, score 2 = 13");
-
03-31-2008, 09:21 AM #8325QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
http://www.gamasutra.com/features/19991018/Gomez_5.htm
Zitat von ZereoX
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
03-31-2008, 11:48 AM #8326QJ Gamer Blue
- Registriert seit
- Jul 2006
- Beiträge
- 132
- Points
- 4.296
- Level
- 41
- Downloads
- 0
- Uploads
- 0
can someone please help? =)
Zitat von cruisx
-
03-31-2008, 12:16 PM #8327OMFG

- Registriert seit
- Jul 2005
- Ort
- Toronto
- Beiträge
- 2.814
- Points
- 19.453
- Level
- 88
- Downloads
- 0
- Uploads
- 0
ugh
Zitat von Xsjado7
Look it over, it's pretty self explanatory. Store the scores in variables, then get them from there.Code:char str[64]; // I would go a little higher just incase of bigger variables int score1 = 10, score2 = 13; sprintf(str, "Score 1 = %i, Score 2 = %i", score1, score2);
-
03-31-2008, 03:48 PM #8328QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
I think he was asking about splitting an existing string.
Zitat von Slasher
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
03-31-2008, 07:20 PM #8329QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
lol, yeah. For eample; i wanna cut "score = 2" and chuck it another string or something to that extent
-
03-31-2008, 10:44 PM #8330QJ Gamer Bronze

- Registriert seit
- Sep 2006
- Ort
- france
- Beiträge
- 170
- Points
- 6.359
- Level
- 52
- Downloads
- 0
- Uploads
- 0
std::string
Why not use std::string instead of messing around with char[] sprintf and the likes? it's so easier.
Zitat von Xsjado7
http://www.cplusplus.com/reference/string/string/
-
03-31-2008, 11:25 PM #8331QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
my apps in C, not C++
-
04-01-2008, 12:07 AM #8332QJ Gamer Bronze

- Registriert seit
- Sep 2006
- Ort
- france
- Beiträge
- 170
- Points
- 6.359
- Level
- 52
- Downloads
- 0
- Uploads
- 0
you can still use std::strings I think, you'll just have to modify some things (.cpp instead of .c for your files, -lstdc++ added in your makefile). this won't stop you writing everything in C if you like, but you'll be able to use std::strings at the same time (you'll also benefit from iostreams & lists/vectors/maps, this will make your life a lot easier).
Zitat von Xsjado7
-
04-01-2008, 12:12 AM #8333QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Oh, ok. Thanks for the help

-= Double Post =-
Just renamed my stuff and added the etra lib but i get errors thrown at me. Im going to try something else. Im gonna write the string to a temporary file on the memory stick. from there i can use sceIo functions like sceIoRead which allows me to tell it how far to read and such. Thanks again for the help thoughGeändert von Xsjado7 (04-01-2008 um 12:23 AM Uhr) Grund: Automerged Doublepost
-
04-01-2008, 12:35 AM #8334QJ Gamer Bronze

- Registriert seit
- Sep 2006
- Ort
- france
- Beiträge
- 170
- Points
- 6.359
- Level
- 52
- Downloads
- 0
- Uploads
- 0
-
04-01-2008, 01:11 AM #8335QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
My errors, and thats just from my main.cpp. I have more than 8 more source filesCode:source/../settings/stats.h(26) : error: expected unqualified-id before 'throw' source/main.cpp: In function 'void newGame()': source/main.cpp(33) : error: 'mainGame' was not declared in this scope source/main.cpp: In function 'void mainGame()': source/main.cpp(89) : warning: passing 'double' for argument 4 to 'void fillScre enRect(Color, int, int, int, int)' source/main.cpp(90) : warning: passing 'double' for argument 4 to 'void fillScre enRect(Color, int, int, int, int)' source/main.cpp(115) : error: expected unqualified-id before 'throw' source/main.cpp(115) : error: expected `)' before 'throw' source/main.cpp(117) : error: expected unqualified-id before 'throw' source/main.cpp(117) : error: expected `;' before 'throw' source/main.cpp(118) : error: expected unqualified-id before 'throw' source/main.cpp(118) : error: expected `;' before 'throw' source/main.cpp: In function 'int main()': source/main.cpp(277) : error: cannot convert 'const char*' to 'short unsigned in t*' for argument '2' to 'int OSK(char*, short unsigned int*, short unsigned int* )' source/main.cpp(364) : error: cannot convert 'const char*' to 'short unsigned in t*' for argument '2' to 'int OSK(char*, short unsigned int*, short unsigned int* )' source/main.cpp(373) : error: 'dispCredits' was not declared in this scope
-
04-01-2008, 01:16 AM #8336QJ Gamer Bronze

- Registriert seit
- Sep 2006
- Ort
- france
- Beiträge
- 170
- Points
- 6.359
- Level
- 52
- Downloads
- 0
- Uploads
- 0
-
04-01-2008, 01:30 AM #8337QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Oh, forgot to mention, "throw" is actually a variable in my "player" struct. I take it its a command in C++ due to it being highlighted in Notepad++ when i type it
-
04-01-2008, 01:54 AM #8338QJ Gamer Bronze

- Registriert seit
- Sep 2006
- Ort
- france
- Beiträge
- 170
- Points
- 6.359
- Level
- 52
- Downloads
- 0
- Uploads
- 0
-
04-01-2008, 02:11 AM #8339QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Ok, i think iv got it sorted out. Do i have to code any different to use those new functions?
-
04-01-2008, 04:32 AM #8340QJ Gamer Bronze

- Registriert seit
- Sep 2006
- Ort
- france
- Beiträge
- 170
- Points
- 6.359
- Level
- 52
- Downloads
- 0
- Uploads
- 0
only when using strings, remember that it's a c++ class, so to allocate memory for it (if you want to use pointers, which in most cases is not needed) istead of malloc use new, and instead of free use delete. apart from that, you can continue working completely in C.
Zitat von Xsjado7
small example to get you started:
PHP-Code:#include <string>
using namespace std;
string str ("this is a string");
//now use the power of the string class: str.substr(), str.find()..
//nothing else to do!


LinkBack URL
About LinkBacks
Mit Zitat antworten



Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum