Seite 84 von 340 ErsteErste ... 34 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 134 184 ... LetzteLetzte
Zeige Ergebnis 2.491 bis 2.520 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 Moca Spoiler for Copy a file to flash1 : u8 dataOut[2000000] __attribute__((aligned(64 ))); int copy_file(char *src, char *dst) ...

  
  1. #2491
    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

    Zitat Zitat von Moca
    Spoiler for Copy a file to flash1:

    u8 dataOut[2000000] __attribute__((aligned(64 )));
    int copy_file(char *src, char *dst)
    {

    SceUID infd = sceIoOpen(src, PSP_O_RDONLY, 0777);
    SceUID outfd = sceIoOpen(dst, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
    int bytesread;



    while ((bytesread = sceIoRead(infd, dataOut, 8192)) > 0)
    {
    sceIoWrite(outfd, dataOut, bytesread);
    }

    sceIoClose(infd);
    sceIoClose(outfd);
    sceIoRemove(src); //Remove this if you want :P
    return 0;
    }
    ///////////////////////////////////////////////////////////////////////////

    void Flash1Assign()
    {

    if (sceIoUnassign("flash1:") < 0)
    {
    printf("!Error unassigning flash1.\n");
    }


    if (sceIoAssign("flash1:", "lflash0:0,1", "flashfat1:", IOASSIGN_RDWR, NULL, 0) < 0)
    {
    printf("!Error re-assigning flash1.\n");
    }

    }
    //////////////////////////////////////////////////////////
    //Good Stuff. Main();.
    int main(int argc, char *argv[])
    {


    pspDebugScreenInit();
    pspDebugScreenClear();
    Flashs1Assign();
    copy_file("ms0:/music.mp3", "flash1:/music.mp3");
    printf("done! :)");
    return 0;
    }



    it flashes backup.mp3 as an folder:|



  2. #2492
    AKA Homer
    Points: 12.596, Level: 73
    Level completed: 37%, Points required for next Level: 254
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Sweden
    Beiträge
    1.779
    Points
    12.596
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von HYde
    Some of you may know that in some Compiler IDE's, you have to tell the program your writing to wait for you. So that you can see your output.
    With C I use getchar(); "mainly for simple programs, or just in the develpoment process" What I have here is two simple programs, the first one everyone knows.

    Spoiler for Example :: Hello World:

    #include <stdio.h>

    main()
    {
    printf("Hello World!\n");

    getchar(); // To pause the console

    return 0;
    }


    Getting to my point and question
    If I compile and run Hello World it paused and waited for me to hit a key. My second example I did.

    Spoiler for Example :: Multiply two numbers:

    #include <stdio.h>

    int a, b, c;

    int product(int x, int y);

    int main()
    {
    // Input the first numbers
    printf("Enter a number between 1 and 100: ");
    scanf("%d", &a);

    // Input the second number
    printf("\nEnter another number between 1 and 100: ");
    scanf("%d", &b);

    // Calculate and display the product
    c = product (a, b);
    printf("\n%d times %d = %d\n", a, b ,c);

    // Keep console open to see result
    getchar();

    return 0;
    }

    /* Function returns the product of its two arguments */
    int product(int x, int y)
    {
    return (x * y);
    }


    When I go to run it I will enter my two numbers, but when I get the output. The console closes before I can see it. This has been bothering me all day. With no answers from goggle ...so far! I know some of you may say just to use Visual C++ or something of that nature, and it will pause it for me. Thats all good! What I have been doing lately is going through some different IDE's. Especially for use with Cygwin for PSP development. "Plus scrapping some of the rust off thats collected on my programming knowledge"

    Maybe thats just it and I'm not seeing the obvious. Maybe someone can put my mind to ease. And I hope this wasn't a waste of time. Sorry if it was, I do need some sleep! :Argh:
    Add a
    Code:
    system("PAUSE");
    right before you return the main function.

  3. #2493
    QJ Gamer Blue
    Points: 4.521, Level: 42
    Level completed: 86%, Points required for next Level: 29
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    137
    Points
    4.521
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    hey, im a new programmer, and i just wondered if there was an equivalent to "scanf()" for the psp...if not is there a way i can easily replace this function?

    thanks in advance

  4. #2494
    QJ Gamer Green
    Points: 5.712, Level: 48
    Level completed: 81%, Points required for next Level: 38
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    USA SC/NC
    Beiträge
    699
    Points
    5.712
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von hallo007
    it flashes backup.mp3 as an folder:|
    Huh? WTF!??!?? :)

    It does not :P
    [CODE]Random Facts:
    irc://irc.malloc.us #wtf #**********
    [/CODE]

    [SIZE="6"][FONT="Century Gothic"][COLOR="Blue"][URL="http://forums.**********.net"]http://forums.**********.net[/URL][/COLOR][/FONT][/SIZE]

  5. #2495
    QJ Gamer Blue
    Points: 8.686, Level: 62
    Level completed: 79%, Points required for next Level: 64
    Overall activity: 45,0%

    Registriert seit
    Jan 2006
    Ort
    CO
    Beiträge
    150
    Points
    8.686
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    It's really not a problem now! Just thought it was weird how one program would stay open and the other wouldn't. I can't figure it out and I hate that.

    Zitat Zitat von yaustar
    Honestly, I would just use another scanf instead of getchar.

    I be guessing you are using DevCpp for the IDE, I personally prefer Code::Blocks myself.
    Do you have code::blocks working with cygwin by chance?


    @Moonchil, yeah I know about system("pause"); personally I think its overkill.

    Just throwing this out there, what IDE's are people useing that work good with cygwin?

  6. #2496
    QJ Gamer Gold
    Points: 14.678, Level: 78
    Level completed: 57%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Beiträge
    1.523
    Points
    14.678
    Level
    78
    Downloads
    0
    Uploads
    0

    Angry

    Code:
    $ make
    psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall  -L. -L/usr/local/
    pspdev/psp/sdk/lib   main.o  -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk
    -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspus
    er -lpspkernel -o Saywhat.elf
    main.o: In function `checkumd':
    main.c:(.text+0x8): undefined reference to `sceUmdCheckMedium'
    collect2: ld returned 1 exit status
    make: *** [Saywhat.elf] Error 1
    Tried using functions in PSPUMD.h & I get these errors! How do i solve it?

    I even added these

    LIBDIR =
    LIBS = -lpspumd
    LDFLAGS =

    How do I solve it. Please help. PLease!
    Geändert von Mr305 (01-10-2007 um 02:08 PM Uhr)

  7. #2497
    QJ Gamer Blue
    Points: 8.686, Level: 62
    Level completed: 79%, Points required for next Level: 64
    Overall activity: 45,0%

    Registriert seit
    Jan 2006
    Ort
    CO
    Beiträge
    150
    Points
    8.686
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    Crazy I was at this site yesterday I don't know how I didnt see this yesterday but this is a good FAQ about implementing a pause. Different examples some not portable and thats what im watching out for.
    http://faq.cprogramming.com/cgi-bin/...&id=1043284385

  8. #2498
    QJ Gamer Platinum
    Points: 57.528, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    h0000000rj
    Beiträge
    12.867
    Points
    57.528
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Mr305
    Code:
    $ make
    psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall  -L. -L/usr/local/
    pspdev/psp/sdk/lib   main.o  -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk
    -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspus
    er -lpspkernel -o Saywhat.elf
    main.o: In function `checkumd':
    main.c:(.text+0x8): undefined reference to `sceUmdCheckMedium'
    collect2: ld returned 1 exit status
    make: *** [Saywhat.elf] Error 1
    Tried using functions in PSPUMD.h & I get these errors! How do i solve it?

    I even added these

    LIBDIR =
    LIBS = -lpspumd
    LDFLAGS =

    How do I solve it. Please help. PLease!
    Please post your source code. Please!
    [I fail @ life]

  9. #2499
    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

    Zitat Zitat von willolner
    hey, im a new programmer, and i just wondered if there was an equivalent to "scanf()" for the psp...if not is there a way i can easily replace this function?

    thanks in advance
    Use it exactly as you would in non-PSP specific programming.

    include stdio.h and just call scanf as you would normally.
    -= Double Post =-
    Zitat Zitat von Mr305
    Tried using functions in PSPUMD.h & I get these errors! How do i solve it?

    I even added these

    LIBDIR =
    LIBS = -lpspumd
    LDFLAGS =

    How do I solve it. Please help. PLease!
    Make sure you have included pspumd.h in your code, and that your LIBS has -lpspumd.

    The output you gave did not have -lpspumd in the LIBS.
    Geändert von Insert_Witty_Name (01-10-2007 um 06:28 PM Uhr) Grund: Automerged Doublepost

    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

  10. #2500
    Developer
    Points: 5.359, Level: 47
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Norway
    Beiträge
    384
    Points
    5.359
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von HYde
    It's really not a problem now! Just thought it was weird how one program would stay open and the other wouldn't. I can't figure it out and I hate that.
    It's because after pressing enter to submit the last value the script will quickly move on and get to the getchar(), then seeing as you still are pressing enter it will move on.

    If you added another getchar() right after the last scanf() then it would wait until you release the enter button and then press it again before continuing on the last getchar().


  11. #2501
    QJ Gamer Platinum
    Points: 57.528, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    h0000000rj
    Beiträge
    12.867
    Points
    57.528
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Insert_Witty_Name
    The output you gave did not have -lpspumd in the LIBS.
    Heh, good call. I took the lazy road ;)
    [I fail @ life]

  12. #2502
    QJ Gamer Blue
    Points: 8.686, Level: 62
    Level completed: 79%, Points required for next Level: 64
    Overall activity: 45,0%

    Registriert seit
    Jan 2006
    Ort
    CO
    Beiträge
    150
    Points
    8.686
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Waterbottle
    It's because after pressing enter to submit the last value the script will quickly move on and get to the getchar(), then seeing as you still are pressing enter it will move on.

    If you added another getchar() right after the last scanf() then it would wait until you release the enter button and then press it again before continuing on the last getchar().
    Nice! I Knew it was going to be something as simple as that.

  13. #2503
    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

    wich icons are for wat (PIC0.png,...)
    and how do you convert your mp3 to at3??

  14. #2504
    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

    Use Goldwave or similar to change your MP3 to AT3.

    PIC1.PNG is the large backround image of your eboot.

    ICON0.PNG is the 144x80 image you see in the menu.

    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. #2505
    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

    thnx i did it:)

    but how do you let repeat the at3 song?

  16. #2506
    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

    At the present time, you can't.

    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. #2507
    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

    didn't art did it?

  18. #2508
    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

    Please speak propper english or don't speak it at all...

    Insomniac - The EBOOT AT3 music can be looped. I don't know how, I just know I've seen it. I liked the bg music of an app and let it play for 5 minutes or so...

    ...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


  19. #2509
    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

    i dont see what's wrong with that:
    didn't art did it
    art = developer
    it= looping at3's
    dind't= i am not sure , but i thnik

    ;)

  20. #2510
    QJ Gamer Blue
    Points: 8.686, Level: 62
    Level completed: 79%, Points required for next Level: 64
    Overall activity: 45,0%

    Registriert seit
    Jan 2006
    Ort
    CO
    Beiträge
    150
    Points
    8.686
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    I don't believe Art did his icon.

    Zitat Zitat von ganon
    Hey Art please tell me how u looped your snd0.at3
    Zitat Zitat von Art
    I didn't do it myself, but I know that it is very difficult to do.
    If you can't use a hex editor to swap the PSP logos without
    bricking a PSP, forget about it.

    The only program that might do it all for you is Soundforge, but I doubt it.
    -= Double Post =-
    Hallo007, are you from the states? It's like when im talking to my cousin from the phillipines. I got ya?
    Geändert von HYde (01-13-2007 um 01:31 PM Uhr) Grund: Automerged Doublepost

  21. #2511
    Points: 3.797, Level: 38
    Level completed: 98%, Points required for next Level: 3
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    37
    Points
    3.797
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von hallo007
    didnt art did it
    its ok, just a simple grammar error (i hate being a teacher), it would be

    "didn't art do it?"

  22. #2512
    Developer
    Points: 5.359, Level: 47
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Norway
    Beiträge
    384
    Points
    5.359
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    What does LL after a number mean?

    example,

    key * 6364136223846793005LL + 1;


  23. #2513
    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

    At a wild guess, it means use this constant as a long long datatype.

    http://publib.boulder.ibm.com/infoce...as400clr36.htm

  24. #2514
    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

    That's pretty much it.

    Same as you can put an 'f' at the end of a float to signify float (rather than double), as in '3.85f'.

    It's useful if you want to use a value but not declare it as a variable and you want it to be a certain data type.

    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

  25. #2515
    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

    Cant you just do:

    float(#)
    (float)#

    Or is that just for a variable?

    ...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


  26. #2516
    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

    hey can anyone point me to a tut on doing 3d games and also how to install/where to find the gui libary's(believe there the 3d ones) as i'm trying to re create my game i'm working on into 3d thanks in advance

    edit: also i've searched this forum and ps2dev forums like: 3d, three,etc but now that i think of it i well try gui
    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. #2517
    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

    For one, its called GU for one reason - Graphics Utility abbreviation. Not GUI.

    Just thought Id say that...

    And your best bet would be to go to psp-programming.com and find that 12 tutorial lesson for the GU in the forums.

    ...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


  28. #2518
    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 ok i wasn't sure between gu and gui anyways thanks i'll check them=-)(didn't think of psp-programming)
    -= Double Post =-
    ok sweet found them thanks a bunch this well really help
    Geändert von slicer4ever (01-14-2007 um 10:36 PM Uhr) Grund: Automerged Doublepost
    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. #2519
    QJ Gamer Gold
    Points: 18.627, Level: 86
    Level completed: 56%, Points required for next Level: 223
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Ort
    LOLWUT
    Beiträge
    2.625
    Points
    18.627
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    Hey all,
    I need to know how to define a function for something I'm making.
    Oh and more than or equal to and less than and equal to.

    Thanks.

    EDIT - is it just
    Code:
    void lol() {
    printf("lololoolooooolllll");
    }
    
    //and then to call it
    lol();
    ?
    Is it supposed to be inside or outside the main loop?

    I just want to make my code cleaner and more organized.
    Geändert von PSPduh (01-15-2007 um 11:37 AM Uhr)

  30. #2520
    Developer
    Points: 5.359, Level: 47
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Norway
    Beiträge
    384
    Points
    5.359
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    outisde of the mainfuction, yes.

    > more than
    < less than
    >= more than or equal
    <= less than or equal



 

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:14 PM Uhr.

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