Seite 151 von 340 ErsteErste ... 51 101 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 201 251 ... LetzteLetzte
Zeige Ergebnis 4.501 bis 4.530 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; Zitat von slicer4ever char mac_address[7] //7 because thats what the function says to have If it is 7 maybe it ...

  
  1. #4501
    QJ Gamer Green
    Points: 5.784, Level: 49
    Level completed: 17%, Points required for next Level: 166
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    France
    Beiträge
    753
    Points
    5.784
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von slicer4ever
    char mac_address[7] //7 because thats what the function says to have
    If it is 7 maybe it is in hexadecimal format ? What is retrieved in your char?

    ++ B.



  2. #4502
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    nothing thats the prob
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  3. #4503
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    slicer -
    Code:
    char *mac_address;
    
    sceWlanGetEtherAddr(mac_address);
    
    if(mac_address < 0)
        //zomg ERROR!
    Try that maybe?

    If not, change the mac_address[7] to [8] ;) you didnt count the '\0'

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  4. #4504
    QJ Gamer Green
    Points: 5.784, Level: 49
    Level completed: 17%, Points required for next Level: 166
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    France
    Beiträge
    753
    Points
    5.784
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    WHat do you mean by "nothing" ??
    random code or nothing like "00" ?

    ++ B.

  5. #4505
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    @sg57

    when i used *mac_address it just crashed my program;

    @maxi when i say nothing i mean i do: osl_Printf_xy(400,40,"%s" ,mac_address);
    and i have the color set to red yet nothing appears

    however the command says it returns a 0 if it works and it currently is showing a 0 it's just not saveing the mac address into my sting
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  6. #4506
    QJ Gamer Green
    Points: 11.300, Level: 70
    Level completed: 13%, Points required for next Level: 350
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Ort
    main();
    Beiträge
    1.071
    Points
    11.300
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    char *mac_address = (char *) malloc(sizeof(char) * 8);

  7. #4507
    Points: 3.266, Level: 35
    Level completed: 44%, Points required for next Level: 84
    Overall activity: 0%

    Registriert seit
    May 2007
    Beiträge
    6
    Points
    3.266
    Level
    35
    Downloads
    0
    Uploads
    0

    Standard

    Maybe try:

    Code:
    char macaddr[20];
    
    int test = sceWlanGetEtherAddr(macaddr);
    
    if (test < 0) {
          printf("Error");
    } else {
          printf("%s",macaddr);
    }

  8. #4508
    Developer
    Points: 7.577, Level: 58
    Level completed: 14%, Points required for next Level: 173
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    1.026
    Points
    7.577
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Update your SDK, that function prototype was changed when I submitted a bug report.

    The mac info is actually stored in an array of unsigned char[7].

    Actually from what I've seen it looks like a union of unsigned char mac (6 bytes) and unsigned char reserved? (2 bytes), but it matters not.

    Code:
    unsigned char macAddr[7];
    memset(macAddr, 0, 7);
    sceWlanGetEtherAddr(macAddr);
    pspDebugScreenPrintf("%02X:%02X:%02X:%02X:%02X:%02X", macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4], macAddr[5]);

    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

  9. #4509
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    o thanks for the telling me i would have never figured that out insert
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  10. #4510
    QJ Gamer Green
    Points: 5.784, Level: 49
    Level completed: 17%, Points required for next Level: 166
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    France
    Beiträge
    753
    Points
    5.784
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    I told you it was in hexa ;)
    %x is used to print hexadecimal values.

    ++ B.

  11. #4511
    Developer
    Points: 7.577, Level: 58
    Level completed: 14%, Points required for next Level: 173
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    1.026
    Points
    7.577
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Actually, I'm surprised no-one picked up on it earlier.

    Each value in a mac address ranges from 00 to FF (hex), which is 0 - 255 in decimal form.

    A char only accepts values from -128 to 127, whereas an unsigned char takes 0 to 255.

    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

  12. #4512
    It's good to be free...
    Points: 10.420, Level: 67
    Level completed: 93%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    2.440
    Points
    10.420
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Yeah but, say I did this:
    char signed_byte = 255 //signed_byte now equals -127
    It accepts it, it just wraps it around. In C at least, I dunno about in C++.
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  13. #4513
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von hallo007
    1)if(strcmp(".mp3", gameEntry[current_selection].name) == 0)

    2) dunno how you made your mp3player
    -= Double Post =-
    error: syntax error before 'RpKeyBoard
    error: syntax error before '{' token
    error: syntax error before '}' token

    Code:
    class RpKeyBoard
    {
          public:
                 int keyPressed();
                 int KEY_ENTER;
                 };
    the code is 100% correct , do i need to include something for classes on psp?
    Thank you dude.
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

  14. #4514
    Developer
    Points: 7.577, Level: 58
    Level completed: 14%, Points required for next Level: 173
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    1.026
    Points
    7.577
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    As an unsigned char, a mac might look like this:

    Code:
    00:01:4A:81:5D:A7
    As a char, it would look like:

    Code:
    00:01:4A:FFFFFF81:5D:FFFFFFA7

    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

  15. #4515
    It's good to be free...
    Points: 10.420, Level: 67
    Level completed: 93%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    2.440
    Points
    10.420
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Yeah, if you converted it to int and then to unsigned int.
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  16. #4516
    Developer
    Points: 7.577, Level: 58
    Level completed: 14%, Points required for next Level: 173
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    1.026
    Points
    7.577
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Try it, I assure you char or unsigned char will print exactly as I've shown.

    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

  17. #4517
    It's good to be free...
    Points: 10.420, Level: 67
    Level completed: 93%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    2.440
    Points
    10.420
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    I've never tried printf("%u",(char)foo); before, so I wouldn't really know. printf probably converts it internally if that's the case.
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  18. #4518
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    arg can some1 help me some more i hate asking questions but i've never worked with these functions so i need some help

    Spoiler for code form pspnet_adhoc.h:

    /**
    * Create a PDP object.
    *
    * @param mac - Your MAC address (from sceWlanGetEtherAddr)
    * @param port - Port to use, lumines uses 0x309
    * @param unk2 - Unknown, lumines sets to 0x400
    * @param unk3 - Unknown, lumines sets to 0
    *
    * @return The ID of the PDP object (< 0 on error)
    */
    int sceNetAdhocPdpCreate(char *mac, int port, unsigned int unk2, int unk3);

    can someone give me an example of how that is surpose to work when properly called this is as far as i've goten:


    sprintf(mac_address_true, "%02X%02X%02X%02X%02X%02X ", mac_address[0], mac_address[1], mac_address[2], mac_address[3], mac_address[4], mac_address[5]);

    int pdp = sceNetAdhocPdpCreate(mac_ address_true,0x309,0x400, 0);

    it keeps returning a negative number and as far as i can see that the mac should look like:
    05d4c3b21a

    however i'm not 100 % sure
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  19. #4519
    MiG
    MiG ist offline
    QJ Gamer Blue
    Points: 5.848, Level: 49
    Level completed: 49%, Points required for next Level: 102
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    499
    Points
    5.848
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Right i've searched around a bit but now gave up:

    How do you use C++ for the PSP, and can you therefore use libraries such as the string, and sstream libraries ?

    Thanks,
    MiG

  20. #4520
    QJ Gamer Green
    Points: 11.300, Level: 70
    Level completed: 13%, Points required for next Level: 350
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Ort
    main();
    Beiträge
    1.071
    Points
    11.300
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    *Smacks head against another wall*

    Add '-lstdc++' to you libs line of your makefile.

  21. #4521
    MiG
    MiG ist offline
    QJ Gamer Blue
    Points: 5.848, Level: 49
    Level completed: 49%, Points required for next Level: 102
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    499
    Points
    5.848
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von PSPJunkie_
    *Smacks head against another wall*

    Add '-lstdc++' to you libs line of your makefile.
    Thanks.

    No need to be an ass about it tho.. Searching C++ just retrieves blank results on the forum.

    I tried to search, and gave up..

    Jeez.
    -= Double Post =-
    Right, just tried this, and i've tried

    #include <string>

    but it still doesn't like me declaring strings with the usual "string x" or watever.
    Geändert von MiG (05-18-2007 um 03:47 AM Uhr) Grund: Automerged Doublepost

  22. #4522
    QJ Gamer Green
    Points: 11.300, Level: 70
    Level completed: 13%, Points required for next Level: 350
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Ort
    main();
    Beiträge
    1.071
    Points
    11.300
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Dude, I don't care what you say. This topic has come up several times, both here and on PSP-Programming.
    Geändert von PSPJunkie_ (05-18-2007 um 04:01 AM Uhr)

  23. #4523
    MiG
    MiG ist offline
    QJ Gamer Blue
    Points: 5.848, Level: 49
    Level completed: 49%, Points required for next Level: 102
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    499
    Points
    5.848
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von PSPJunkie_
    Dude, I don't what you say. This topic has come up several times, both here and on PSP-Programming.
    Well some links would be nice.

    I'd love a comprehensive set of instructions to using c++ on the PSP.

  24. #4524
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    The order of libs matters for some reason when linking to the C++ STL libraries. I don't have it with me but I post it up later.

  25. #4525
    MiG
    MiG ist offline
    QJ Gamer Blue
    Points: 5.848, Level: 49
    Level completed: 49%, Points required for next Level: 102
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    499
    Points
    5.848
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar
    The order of libs matters for some reason when linking to the C++ STL libraries. I don't have it with me but I post it up later.
    thanks.

  26. #4526
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von slicer4ever
    arg can some1 help me some more i hate asking questions but i've never worked with these functions so i need some help

    Spoiler for code form pspnet_adhoc.h:

    /**
    * Create a PDP object.
    *
    * @param mac - Your MAC address (from sceWlanGetEtherAddr)
    * @param port - Port to use, lumines uses 0x309
    * @param unk2 - Unknown, lumines sets to 0x400
    * @param unk3 - Unknown, lumines sets to 0
    *
    * @return The ID of the PDP object (< 0 on error)
    */
    int sceNetAdhocPdpCreate(char *mac, int port, unsigned int unk2, int unk3);

    can someone give me an example of how that is surpose to work when properly called this is as far as i've goten:


    sprintf(mac_address_true, "%02X%02X%02X%02X%02X%02X ", mac_address[0], mac_address[1], mac_address[2], mac_address[3], mac_address[4], mac_address[5]);

    int pdp = sceNetAdhocPdpCreate(mac_ address_true,0x309,0x400, 0);

    it keeps returning a negative number and as far as i can see that the mac should look like:
    05d4c3b21a

    however i'm not 100 % sure
    any1?
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  27. #4527
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    you are trying to make an adhoc connection?

  28. #4528
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    yes
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  29. #4529
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    http://www.psp-programming.com/forum...hp?topic=473.0

    A example , it's a bit more then just a function

  30. #4530
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    thanks
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 09:15 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .