Seite 40 von 340 ErsteErste ... 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 90 140 ... LetzteLetzte
Zeige Ergebnis 1.171 bis 1.200 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 waterbottle if (x>=50) is true if x is larger then or equal to 50. but since you never ...

  
  1. #1171
    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 waterbottle
    if (x>=50)
    is true if x is larger then or equal to 50.
    but since you never make x increase nothing else will happen. add x++; or somthin
    haha lol , that was in my programm , but i dindt written it in this thread;)



  2. #1172
    QJ Gamer Bronze
    Points: 14.090, Level: 77
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    USA
    Beiträge
    496
    Points
    14.090
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    How do I make an If,Then statement satisfy multiple conditions?

    Code:
    if (k->held.cross & sel = 1)
         //code;
    I always do stuff in LUA and now want to learn C++. Im using the oslib (Old School Lib) to make a little sample thing to get expierence.

    Just help and dont give smartass comments.

  3. #1173
    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

    Code:
    Logical AND (what you want)
    if(statement1 && statement2)
    
    Bitwise AND
    if(statement1 & statement2)
    
    Logical OR
    if(statement1 || statement2)
    
    Bitwise OR (not sure about this one :P)
    if(statement1 | statement2)


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  4. #1174
    QJ Gamer Bronze
    Points: 14.090, Level: 77
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    USA
    Beiträge
    496
    Points
    14.090
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Thanks. I'll try figure out all the other problems myself.

  5. #1175
    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 CtrlAltDeleteDie
    Thanks. I'll try figure out all the other problems myself.
    Feel free to post here, that's what this thread's supposed to be for you know :Punk:


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  6. #1176
    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

    Homer - You're correct, there's bitwise and logical AND, OR operators. But bitwise can return more than 1 or 0 ;)

    Oh and homer - You're good with emulators, per say, right? think you could help me with a little... problem... Ill pm you with details if you want to, id very appreciate it :)

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


  7. #1177
    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 SG57
    Oh and homer - You're good with emulators, per say, right? think you could help me with a little... problem... Ill pm you with details if you want to, id very appreciate it :)
    Okay, sure. I might be able to help


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  8. #1178
    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

    Ok sweet, how can i contact you? AIM (recommended), MSN, IRC, PM (not recommened)?

    I find it better to give you info in portions then one large PM :o

    P.S. Thanks for this

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


  9. #1179
    QJ Gamer Bronze
    Points: 14.090, Level: 77
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    USA
    Beiträge
    496
    Points
    14.090
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Ok. I decided to post again...

    I probably dont need to post all this, but I will anyways.

    Code:
    int main(int argc, char* argv[])
    {
    	//Initialize the different parts of the library
    	oslInit(0);
    	oslInitGfx(OSL_PF_8888, 1);
    	oslSetBkColor(RGBA(0,0,0,0));
    	oslSetTextColor(RGB(255,255,255));
    	oslInitConsole();
    	OSL_CONTROLLER *k;
    
    	//Main loop
    	while (!osl_quit)
    	{
    		//Display code
                    oslStartDrawing();
                    paint = oslLoadImageFile("ms0:/img.png", OSL_IN_VRAM, OSL_PF_8888);
                    //Draw
    		oslDrawGradientRect(0, 0, 480, 272, RGB(255,255,255), RGB(255,255,255), RGB(100,100,100), RGB(100,100,100));
    		oslDrawFillRect(50, 50, 150, 150, RGB(255,0,0));
    .........
    The main error I got was, "paint was not declared in this scope". As you can tell I have no idea what I am doing, but I am learning from trial and error.

  10. #1180
    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

    Code:
    paint = oslLoadImageFile("ms0:/img.png", OSL_IN_VRAM, OSL_PF_8888);
    You haven't declared paint as a datatype, I have no idea what the image struct is called in oslib. I'm sure it says in the documentation though (if it has any).


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  11. #1181
    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

    It's correct. 'paint' is uninitialized. What data type must 'paint' be? Proably a structure pointer, but... to what? (i dont know OSL)

    EDIT

    homer beat me to it :Argh:

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


  12. #1182
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    The bitwise OR (|) take two numbers like this:
    110101101
    101011101
    ------------
    111111101

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

    EDIT (or something).
    I think the stuct you want is named OSL_IMAGE.
    So the paint line should look like this
    Code:
    OSL_IMAGE *paint = oslLoadImageFile("ms0:/img.png", OSL_IN_VRAM, OSL_PF_8888);
    However, you probably want to put that outside (before) the main loop or it'll load the image on each loop :P


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  14. #1184
    QJ Gamer Bronze
    Points: 14.090, Level: 77
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    USA
    Beiträge
    496
    Points
    14.090
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Thanks again Homer. I dont know why I didn't include that in the code before.

  15. #1185
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    can you help me?
    Code:
    #include <pspdisplay.h>
    #include <pspgu.h>
    #include <pspkernel.h>
    #include <pspctrl.h>
    #include <pspdebug.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <math.h>
    #include <time.h>
    #include <png.h>
    #include <string.h>
    #include "graphics.h"
    #include "framebuffer.h"
    #include "flib.h"
    #define printf pspDebugScreenPrintf
    #define dprint pspDebugScreenPrintf
    #define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
    #define true 1
    #define false !true
    #define bool int
    #define NULL 0
    
    PSP_MODULE_INFO("OMG HAX!!!!1", 0, 1, 1);
    
    /* Standard callbacks */
    int exit_callback(int arg1, int arg2, void *common) {
              sceKernelExitGame();
              return 0;
    }
    
    int CallbackThread(SceSize args, void *argp) {
              int cbid;
    
              cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
              sceKernelRegisterExitCallback(cbid);
    
              sceKernelSleepThreadCB();
    
              return 0;
    }
    
    int SetupCallbacks(void) {
              int thid = 0;
    
              thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
              if(thid >= 0) {
                        sceKernelStartThread(thid, 0, 0);
              }
    
              return thid;
    }
    
    int rand_nums() {
            short rn0 = 0;
            short rn1 = 0;
            short rn2 = 0;
            bool win_status = false;
            SceCtrlData pad;
            sceCtrlPeekBufferPositive(&pad, 1);
            srand(sceKernelLibcTime(NULL));
            if(pad.Buttons & PSP_CTRL_CROSS) {
                     rn0=rand()%1,3;
                     rn1=rand()%1,3;
                     rn2=rand()%1,3;
            }
            if(rn0 == 1 && rn1 == 1 && rn2 == 1) {
                    win_status=true;
                    if(win_status == true) {
                      pspDebugScreenSetXY(0,2);
                      pspDebugScreenClear();
                      pspDebugScreenSetBackColor(0x00FF0000);
                      pspDebugScreenSetTextColor(0x00000000);
                      pspDebugScreenPrintf("You won.\n");
                      pspDebugScreenPrintf("Press '~X~' to restart.\n");
                      sceKernelSleepThread();
                      if(pad.Buttons & PSP_CTRL_CROSS) {
                        rand_nums();
                      }
                    }
            }
            if(rn0 == 2 && rn1 == 2 && rn2 == 2) {
                    win_status=true;
                    if(win_status == true) {
                      pspDebugScreenSetXY(0,2);
                      pspDebugScreenClear();
                      pspDebugScreenSetBackColor(0x00FF0000);
                      pspDebugScreenSetTextColor(0x00000000);
                      pspDebugScreenPrintf("You won.\n");
                      pspDebugScreenPrintf("Press '~X~' to restart.\n");
                      sceKernelSleepThread();
                      if(pad.Buttons & PSP_CTRL_CROSS) {
                        rand_nums();
                      }
                    }
            }
            if(rn0 == 3 && rn1 == 3 && rn2 ==3) {
                    win_status=true;
                    if(win_status == true) {
                      pspDebugScreenSetXY(0,2);
                      pspDebugScreenClear();
                      pspDebugScreenSetBackColor(0x00FF0000);
                      pspDebugScreenSetTextColor(0x00000000);
                      pspDebugScreenPrintf("You won.\n");
                      pspDebugScreenPrintf("Press '~X~' to restart.\n");
                      sceKernelSleepThread();
                      if(pad.Buttons & PSP_CTRL_CROSS) {
                        rand_nums();
                      }
                    }
            }
            if(rn0 == 0 && rn1 == 0 && rn2 == 0) {
                    pspDebugScreenSetXY(0,2);
                    pspDebugScreenClear();
                    pspDebugScreenSetBackColor(0x00FF0000);
                    pspDebugScreenSetTextColor(0x00000000);
                    pspDebugScreenPrintf("Press '~X~' to start\n");
                    sceKernelSleepThread();
                    if(pad.Buttons & PSP_CTRL_CROSS) {
                       pspDebugScreenSetXY(0,2);
                       pspDebugScreenClear();
                       pspDebugScreenSetBackColor(0x00FF0000);
                       pspDebugScreenSetTextColor(0x00000000);
                       rn0=rand()%1,3;
                       rn1=rand()%1,3;
                       rn2=rand()%1,3;
                    }
                }
    }
    int main(void) {
                    pspDebugScreenInit();
                    SetupCallbacks();
                    initGraphics();
                    void show_errmsg(const char *errmsg);
              while(true) {
                        rand_nums();
              }
    return 0;
    }
    the problem is, that it compiles but when i load it the screen isnt fully blue and when i use
    Code:
    flipScreen();
    It makes the screen flicker.

  16. #1186
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von psphacker12.
    can you help me?
    Code:
    #include <pspdisplay.h>
    #include <pspgu.h>
    #include <pspkernel.h>
    #include <pspctrl.h>
    #include <pspdebug.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <math.h>
    #include <time.h>
    #include <png.h>
    #include <string.h>
    #include "graphics.h"
    #include "framebuffer.h"
    #include "flib.h"
    #define printf pspDebugScreenPrintf
    #define dprint pspDebugScreenPrintf
    #define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
    #define true 1
    #define false !true
    #define bool int
    #define NULL 0
    
    PSP_MODULE_INFO("OMG HAX!!!!1", 0, 1, 1);
    
    /* Standard callbacks */
    int exit_callback(int arg1, int arg2, void *common) {
              sceKernelExitGame();
              return 0;
    }
    
    int CallbackThread(SceSize args, void *argp) {
              int cbid;
    
              cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
              sceKernelRegisterExitCallback(cbid);
    
              sceKernelSleepThreadCB();
    
              return 0;
    }
    
    int SetupCallbacks(void) {
              int thid = 0;
    
              thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
              if(thid >= 0) {
                        sceKernelStartThread(thid, 0, 0);
              }
    
              return thid;
    }
    
    int rand_nums() {
            short rn0 = 0;
            short rn1 = 0;
            short rn2 = 0;
            bool win_status = false;
            SceCtrlData pad;
            sceCtrlPeekBufferPositive(&pad, 1);
            srand(sceKernelLibcTime(NULL));
            if(pad.Buttons & PSP_CTRL_CROSS) {
                     rn0=rand()%1,3;
                     rn1=rand()%1,3;
                     rn2=rand()%1,3;
            }
            if(rn0 == 1 && rn1 == 1 && rn2 == 1) {
                    win_status=true;
                    if(win_status == true) {
                      pspDebugScreenSetXY(0,2);
                      pspDebugScreenClear();
                      pspDebugScreenSetBackColor(0x00FF0000);
                      pspDebugScreenSetTextColor(0x00000000);
                      pspDebugScreenPrintf("You won.\n");
                      pspDebugScreenPrintf("Press '~X~' to restart.\n");
                      sceKernelSleepThread();
                      if(pad.Buttons & PSP_CTRL_CROSS) {
                        rand_nums();
                      }
                    }
            }
            if(rn0 == 2 && rn1 == 2 && rn2 == 2) {
                    win_status=true;
                    if(win_status == true) {
                      pspDebugScreenSetXY(0,2);
                      pspDebugScreenClear();
                      pspDebugScreenSetBackColor(0x00FF0000);
                      pspDebugScreenSetTextColor(0x00000000);
                      pspDebugScreenPrintf("You won.\n");
                      pspDebugScreenPrintf("Press '~X~' to restart.\n");
                      sceKernelSleepThread();
                      if(pad.Buttons & PSP_CTRL_CROSS) {
                        rand_nums();
                      }
                    }
            }
            if(rn0 == 3 && rn1 == 3 && rn2 ==3) {
                    win_status=true;
                    if(win_status == true) {
                      pspDebugScreenSetXY(0,2);
                      pspDebugScreenClear();
                      pspDebugScreenSetBackColor(0x00FF0000);
                      pspDebugScreenSetTextColor(0x00000000);
                      pspDebugScreenPrintf("You won.\n");
                      pspDebugScreenPrintf("Press '~X~' to restart.\n");
                      sceKernelSleepThread();
                      if(pad.Buttons & PSP_CTRL_CROSS) {
                        rand_nums();
                      }
                    }
            }
            if(rn0 == 0 && rn1 == 0 && rn2 == 0) {
                    pspDebugScreenSetXY(0,2);
                    pspDebugScreenClear();
                    pspDebugScreenSetBackColor(0x00FF0000);
                    pspDebugScreenSetTextColor(0x00000000);
                    pspDebugScreenPrintf("Press '~X~' to start\n");
                    sceKernelSleepThread();
                    if(pad.Buttons & PSP_CTRL_CROSS) {
                       pspDebugScreenSetXY(0,2);
                       pspDebugScreenClear();
                       pspDebugScreenSetBackColor(0x00FF0000);
                       pspDebugScreenSetTextColor(0x00000000);
                       rn0=rand()%1,3;
                       rn1=rand()%1,3;
                       rn2=rand()%1,3;
                    }
                }
    }
    int main(void) {
                    pspDebugScreenInit();
                    SetupCallbacks();
                    initGraphics();
                    void show_errmsg(const char *errmsg);
              while(true) {
                        rand_nums();
              }
    return 0;
    }
    the problem is, that it compiles but when i load it the screen isnt fully blue and when i use
    Code:
    flipScreen();
    It makes the screen flicker.

    its not :

    Code:
    while (true) {
    its:

    Code:
    while (1) {
    --------------------------------------------------------------------------------------

  17. #1187
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Grimfate126
    its not :

    Code:
    while (true) {
    its:

    Code:
    while (1) {
    ok ill try that then
    edit: that makes absolutley no difference..
    Geändert von psphacker12. (10-08-2006 um 05:12 PM Uhr)

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

    Technically, if you define true as 1, it works ;)

    ...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. #1189
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    duh...
    Code:
     #define true 1
    lol

  20. #1190
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    Technically, if you define true as 1, it works ;)
    hey, im not THAT dumb. ;)

    psp, then i dunno whats wrong.. (too lazy to inspect the whole entire code.)
    --------------------------------------------------------------------------------------

  21. #1191
    QJ Gamer Blue
    Points: 5.300, Level: 46
    Level completed: 75%, Points required for next Level: 50
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Egypt
    Beiträge
    378
    Points
    5.300
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    would anybody be kind enough and help me?

    ive read the insomaniacs tutorial and i followed everything written on the screen..the last step claims to change the path to a certain thing

    starts with @off

    cywin worked before that, but now it doesnt start. does anybody know what the path to cygwin was before chainging it so i can reinstall the toolchain (im guessing thats my problem) although ive installed it already...

    Edit://

    I got it :) But thanks anybody to anyone willing to help...

  22. #1192
    QJ Gamer Blue
    Points: 4.511, Level: 42
    Level completed: 81%, Points required for next Level: 39
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Germany
    Beiträge
    216
    Points
    4.511
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Strings

    Hi, I'm having troubles with strings recieved via TCP; I'm getting a string "[list of artists]" from a simple TCP echo server (you don't need to view this, all it does is recieve a command (string) from the client and answer "[list of artists]".

    Spoiler for server code:
    Code:
        for (;;) {
            len = sizeof(client);
            fd = accept(sock, (struct sockaddr*)&client, &len);
            if (fd < 0)
                error_exit("Error while accepting\n");
    		
    		printf("Incoming Client: %s\n", inet_ntoa(client.sin_addr));
    
    		if((rc = recv(fd,commandbuffer,RCVCOMMSIZE,0)) < 0)
    			printf("Error while recieving the command; error-code: %d\n",WSAGetLastError());
    		if(rc==0)
    			printf("Client has closed the connection...\n");
    
    		commandbuffer[rc]='\0';
    		printf("Client command: %s\n",commandbuffer);
    
    		printf("Sending answer...\n");
    		sprintf(answer,"[list of artists]");
    		rc=send(fd,answer,strlen(answer),0);
    
    	printf("Closing connection\n\n\n");
            closesocket(fd);


    More relevant code; How the client recieves the string from the server:

    Code:
        command = "get_artists";
        command_len = strlen(command);
    
    	if (send(socket, command, command_len, 0) != command_len) {
            printf("send() sent a different length of bytes than expected!\n");
    		return;
    	}
    	printf("sending command get_artists...\n");
    
    	printf("recieving...\n");
    	while(rc!=SOCKET_ERROR)
    	{
    		printf("Recieving package %d\n", i);
    		rc = recv(socket,buf,256,0);
    		buf[rc]='\0';
    		if(rc==0)
    		{
    			printf("Server has closed the connnection\n");
    			break;
    		}
    		if(rc==SOCKET_ERROR)
    		{
    			printf("Error: recv, error-code: %s\n",strerror(errno));
    			break;
    		}
    		strcat(recivedMessage, " - ");
    		strcat(recivedMessage, buf);
    		printf("buf: %s\n", buf);
    		printf("recivedMessage: %s\n", recivedMessage);
    		i++;
    	}
    	printf("\n\nget_artists returned: %s\n", recivedMessage);
    IMHO seems fine, but look what he does:

    Could it be that he prints buf, which as an array has the size of 265, completely, the whole 256 chars?
    -= Double Post =-
    PS: Damn that psp is dirty!
    Geändert von Lukeson (10-09-2006 um 07:53 AM Uhr) Grund: Automerged Doublepost

  23. #1193
    Developer
    Points: 14.558, Level: 78
    Level completed: 27%, Points required for next Level: 292
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    166
    Points
    14.558
    Level
    78
    Downloads
    0
    Uploads
    0

    Standard

    buf[rc]='\0';
    if(rc==0)
    {
    printf("Server has closed the connnection\n");
    break;
    }
    from the look at your picture:
    you set a Null terminating character depending on rc (recieved bytes).
    In your photo you also see that the psp puts out "Server has closed the connection"
    This only happens if rc==0;
    so in your case yout set '\0' or 0x00 immediately at the first position of your char buffer.
    Furthermore printf only puts out chars till he finds '\0' so it's clear why you don't get anything ;)

  24. #1194
    QJ Gamer Bronze
    Points: 14.090, Level: 77
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    USA
    Beiträge
    496
    Points
    14.090
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Im having trouble compiling a program in CYGWIN. It compiles an .elf file which i can just rename to a .pbp, but I gives an arror when it goes to make a .pbp. Ill post what CYGWIN spits out.
    Code:
    ........
     -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver
    -lpsputility -lpspuser -lpspkernel -o Square.elf
    psp-fixup-imports Square.elf
    psp-strip Select Square.elf -o Select Square_strip.elf
    Usage: psp-strip <option(s)> in-file(s)
     Removes symbols and sections from files
     The options are:
      -I --input-target=<bfdname>      Assume input file is in format <bfdname>
      -O --output-target=<bfdname>     Create an output file in format <bfdname>
      -F --target=<bfdname>            Set both input and output format to <bfdname>
    
      -p --preserve-dates              Copy modified/access timestamps to the output
    
      -R --remove-section=<name>       Remove section <name> from the output
      -s --strip-all                   Remove all symbol and relocation information
      -g -S -d --strip-debug           Remove all debugging symbols & sections
         --strip-unneeded              Remove all symbols not needed by relocations
         --only-keep-debug             Strip everything but the debug information
      -N --strip-symbol=<name>         Do not copy symbol <name>
      -K --keep-symbol=<name>          Only copy symbol <name>
      -w --wildcard                    Permit wildcard in symbol comparison
      -x --discard-all                 Remove all non-global symbols
      -X --discard-locals              Remove any compiler-generated symbols
      -v --verbose                     List all object files modified
      -V --version                     Display this program's version number
      -h --help                        Display this output
         --info                        List object formats & architectures supported
    
      -o <file>                        Place stripped output into <file>
    psp-strip: supported targets: elf32-littlemips elf32-bigmips elf64-bigmips elf64
    -littlemips elf64-little elf64-big elf32-little elf32-big srec symbolsrec tekhex
     binary ihex
    make: *** [EBOOT.PBP] Error 1
    Help?

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

    Do you use the sdk makefile or your custom?


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  26. #1196
    QJ Gamer Bronze
    Points: 14.090, Level: 77
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    USA
    Beiträge
    496
    Points
    14.090
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Makefile:

    Code:
    TARGET = Select Square
    OBJS = main.o
    YOURLIBS=
    
    INCDIR =
    CFLAGS = -G4 -Wall -O2
    CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS = $(CFLAGS)
    
    LIBDIR =
    LDFLAGS =
    STDLIBS= -losl -lpng -lz \
    		-lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgu -lpspaudiolib -lpspaudio -lm
    LIBS=$(STDLIBS)$(YOURLIBS)
    
    EXTRA_TARGETS = EBOOT.PBP
    PSP_EBOOT_TITLE = SelectPSP
    
    PSPSDK=$(shell psp-config --pspsdk-path)
    include $(PSPSDK)/lib/build.mak

  27. #1197
    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 o Chaps, i got a problem, Cygwin is broke, and i cant delete it to get rid of it to re-install..

    It comes up with a Error saying the folder cant be deleted, but that is utter crap since i've tried numerous unlocking programs, and i'm also the owner of the folder according to windows security.

    Anyway to delete this pile of steaming **** off my harddrive ?

  28. #1198
    QJ Gamer Blue
    Points: 4.511, Level: 42
    Level completed: 81%, Points required for next Level: 39
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Germany
    Beiträge
    216
    Points
    4.511
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von tommydanger
    from the look at your picture:
    you set a Null terminating character depending on rc (recieved bytes).
    In your photo you also see that the psp puts out "Server has closed the connection"
    This only happens if rc==0;
    so in your case yout set '\0' or 0x00 immediately at the first position of your char buffer.
    Furthermore printf only puts out chars till he finds '\0' so it's clear why you don't get anything ;)
    So I put "buf[rc]='\0';" after the break, but he still prints those huge spaces instread of a nice and clean

    sending command get_artists...
    recieving...
    Recieving package 1
    buf: [list of artists]
    recivedMessage: [list of artists]
    Server has closed the connnection

    get_artists returned: [list of artists]

    What he prints:

  29. #1199
    Developer
    Points: 14.558, Level: 78
    Level completed: 27%, Points required for next Level: 292
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    166
    Points
    14.558
    Level
    78
    Downloads
    0
    Uploads
    0

    Standard

    no this is due to the linefeeds you added in your printf commands "\n"
    last statement:
    printf("\n\nget_artists returned: %s\n", recivedMessage);
    make 2 linfeeds before writing the string ;)

  30. #1200
    QJ Gamer Blue
    Points: 4.511, Level: 42
    Level completed: 81%, Points required for next Level: 39
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Germany
    Beiträge
    216
    Points
    4.511
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von tommydanger
    no this is due to the linefeeds you added in your printf commands "\n"
    such a huge space?
    Zitat Zitat von tommydanger
    last statement:
    printf("\n\nget_artists returned: %s\n", recivedMessage);
    make 2 linfeeds before writing the string ;)
    What? that'd be even more space!
    -= Double Post =-
    Could it be because 'buf' is a array of the size of 265?
    -= Double Post =-
    Could it be because 'buf' is a array of the size of 265?
    I reduced the size of the array to 56 and still get the same screen (
    Geändert von Lukeson (10-09-2006 um 09:06 AM Uhr) Grund: Automerged Doublepost


 

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 .