Seite 79 von 340 ErsteErste ... 29 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 129 179 ... LetzteLetzte
Zeige Ergebnis 2.341 bis 2.370 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; TUW, please add me on msn...

  
  1. #2341
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    TUW, please add me on msn


    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  2. #2342
    The Unique Developer
    Points: 7.101, Level: 55
    Level completed: 76%, Points required for next Level: 49
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Canada
    Beiträge
    1.059
    Points
    7.101
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    I have no time ... maybe later.
    too busy with gf now :/
    Malloc.Us Network Administrator

    Decryption of the Encrypted


    You are the unseen, the unstoppable and in power of your code. The God of your software.

  3. #2343
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    oh ok lol.
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  4. #2344
    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 overwrited the SDK with the HENSDK

  5. #2345
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    u mean overwrote
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

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

    yeah;)

  7. #2347
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    if there's any good C devs here willing to help me then please add me on MSN- [email protected] much appreciated
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  8. #2348
    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 want help , but i am not good;)

  9. #2349
    The Unique Developer
    Points: 7.101, Level: 55
    Level completed: 76%, Points required for next Level: 49
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Canada
    Beiträge
    1.059
    Points
    7.101
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    please don't edit the SDK if you don't know how to...
    so hallo007 use SE-SDK with the real SDK don't change it!
    Thanks,
    TUW
    Malloc.Us Network Administrator

    Decryption of the Encrypted


    You are the unseen, the unstoppable and in power of your code. The God of your software.

  10. #2350
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    how do you list a directory in C.
    and then how do you kind of use each file.
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

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

    Word of advice to any that are doing some calculations such as this. Order of Operations is important, if you hadnt already knew.

    Code:
    //simplest parabola
    y = -x^2
    // when x = 5, it comes out as -25, not 25 as it calculates exponents than multiplication
    
    // simplest parabola
    y=(-x)^2
    // when x  5, it comes out as 25, not -25 as it multiplies x by -1, than squares it
    Gave me a little trouble ;)

    My fountain was going downward rather than upward and i was baffled until i did a quick check on my math. Very important stuff ;)

    Glyndder - Why are you ASKING people to do things for you? I believe you know where the 'pspiofilemgr.h' header is in your SDK. Not to mention a quick source code skim of multiple apps will help you without having people do it for you, in a sense.
    -= Double Post =-
    Or you couldd use the dirent library. Google dirent in C or directory browser dirent in C.

    See what happens
    Geändert von SG57 (12-15-2006 um 02:59 PM Uhr) Grund: Automerged Doublepost

    ...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. #2352
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    thanks!
    I didnt think of looking at the io header in the sdk.
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  13. #2353
    The Unique Developer
    Points: 7.101, Level: 55
    Level completed: 76%, Points required for next Level: 49
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Canada
    Beiträge
    1.059
    Points
    7.101
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Alex_G -->
    Code:
    void GetDirectoryList(const char *root){
    struct SceIoDirent dir;
    memset(&dir, 0, sizeof(SceIoDirent));
    static int dfd;
    dfd = sceIoDopen(root);
    if(dfd > 0){
    int f=0;for(f=0;f<MAX_ENTRIES;f++){if(photoEntry[f].name){free(photoEntry[f].name);}photoEntry[f].name = NULL;}
    int count = 0;count = 0;
    while(sceIoDread(dfd, &dir) > 0){
    static char* name;
    name = (char*)memalign(16,300);
    sprintf(name,"%s/%s", root, dir.d_name);
    static int s=0;
    s=strlen(name);
    photoEntry[count].name = strupr(name);
    photoEntry[count].length = s;
    // check for a file
    if (FIO_S_IFREG & (dir.d_stat.st_mode & FIO_S_IFMT)) {
    photoEntry[count].type =FIO_SO_IFREG;
    }
    // check for a folder
    if (FIO_S_IFDIR & (dir.d_stat.st_mode & FIO_S_IFMT)) 
    {
    photoEntry[count].type =FIO_SO_IFDIR;
    }
    count++;if(count>MAX_ENTRIES-1){count = MAX_ENTRIES-1;}
    photoEntriesTotal = count;if(photoEntriesTotal < 0){photoEntriesTotal = 0;}
    }
    }
    sceIoDclose(dfd);
    
    
    }
    and my photoEntry struct is this :
    Code:
    struct PhotoEntry
    {
    char *name;
    int type;
    int length;
    };
    and its defined like this :
    Code:
    #define MAX_ENTRIES 100
    struct PhotoEntry photoEntry[MAX_ENTRIES];
    :)
    Geändert von the unique warrior (12-15-2006 um 03:48 PM Uhr)
    Malloc.Us Network Administrator

    Decryption of the Encrypted


    You are the unseen, the unstoppable and in power of your code. The God of your software.

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

    TUW - I do so hate your un-indenting coding methods... with a passion ;)

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


  15. #2355
    The Unique Developer
    Points: 7.101, Level: 55
    Level completed: 76%, Points required for next Level: 49
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Canada
    Beiträge
    1.059
    Points
    7.101
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    TUW - I do so hate your un-indenting coding methods... with a passion ;)
    You do??!!! oh well what can I say .... its me :)
    Malloc.Us Network Administrator

    Decryption of the Encrypted


    You are the unseen, the unstoppable and in power of your code. The God of your software.

  16. #2356
    QJ Gamer Silver
    Points: 7.385, Level: 57
    Level completed: 18%, Points required for next Level: 165
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Finland
    Beiträge
    752
    Points
    7.385
    Level
    57
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von the unique warrior
    You do??!!! oh well what can I say .... its me :)
    I agree with SG57, code which isn't indented is horrible to read. Indent, it's good for everyone, the writers and the readers :P

    Actually, when I started coding, I kinda just started indenting like automatically, I couldn't even think about NOT indenting :P

    But yeah, whatever. Anyone have any idea how the DH Launcher launches devhook? I can't find anything on a quick look in the launcher sources
    wheeee =:D

  17. #2357
    The Unique Developer
    Points: 7.101, Level: 55
    Level completed: 76%, Points required for next Level: 49
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Canada
    Beiträge
    1.059
    Points
    7.101
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    if you guys check uflash's source out you'll see that its indented :)
    and that code was simply taken from ps2de forums I only changed the sruct and added file type and length .
    :P
    Malloc.Us Network Administrator

    Decryption of the Encrypted


    You are the unseen, the unstoppable and in power of your code. The God of your software.

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

    mATIAZ - I dont have a PSP, so cant help you there... As for the indenting, i do it automatically since it makes my code structured in a sense, and i can easily go back and forth without getting lost in nested loops and whatnot. I dont see how TUW gets anything efficiently done ;) jk

    EDIT

    Ok, gotcha ;)

    ...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. #2359
    QJ Gamer Green
    Points: 9.253, Level: 64
    Level completed: 68%, Points required for next Level: 97
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Australia - A.C.T.
    Beiträge
    1.517
    Points
    9.253
    Level
    64
    Downloads
    0
    Uploads
    0

    Standard

    i normaly indent when i'm cleaning up the code befor release

  20. #2360
    The Unique Developer
    Points: 7.101, Level: 55
    Level completed: 76%, Points required for next Level: 49
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Canada
    Beiträge
    1.059
    Points
    7.101
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    well its better to code indented ;)
    Malloc.Us Network Administrator

    Decryption of the Encrypted


    You are the unseen, the unstoppable and in power of your code. The God of your software.

  21. #2361
    Points: 3.593, Level: 37
    Level completed: 62%, Points required for next Level: 57
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Beiträge
    11
    Points
    3.593
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Hello. I'm trying to get a scrollbar working. It's halfway here, but I can't seem to find the error that is keeping it from being 100% working.

    Anyways, what I am trying to do is display only 5 words in a list of 9 words, lets say as an example; 1000, 2000, 3000, .... 9000. So for instance, it would display 1000 to 5000 on startup: ex
    1000
    2000
    3000
    4000
    5000

    One of the numbers would be highlighted, for instance; 1000. When you scroll down, only the 2000 will be highlighted instead. When you scroll past 3000, instead of just highlighting the next number, the whole list will move down, ex:
    2000
    3000
    4000 (now highlighted)
    5000
    6000

    and so on.

    It works okay, exept that my code displays something like this:
    1000
    20001000
    300020001000
    4000300020001000
    50004000300020001000

    The highlighting and scrolling work like I intended, by for some reason, each line repeats all the numbers. Here is my code, can anyone spot the problem? Thanks!

    P.S. Ignore any extra includes and such in the code, it will be part of a bigger code.
    Code:
    #include <pspkernel.h>
    #include <pspdisplay.h>
    #include <pspctrl.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <psppower.h>
    #include <pspgu.h>
    #include <png.h>
    #include <time.h>
    
    #include "graphics.h" 
    
    PSP_MODULE_INFO("test", 0, 1, 1);
    #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
    
    /* Exit callback */
    int exit_callback(int arg1, int arg2, void *common) {
              sceKernelExitGame();
              return 0;
    }
    
    /* Callback thread */
    int CallbackThread(SceSize args, void *argp) {
              int cbid;
    
              cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
              sceKernelRegisterExitCallback(cbid);
    
              sceKernelSleepThreadCB();
    
              return 0;
    }
    
    /* Sets up the callback thread and returns its thread id */
    int SetupCallbacks(void) {
              int thid = 0;
    
              thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
              if(thid >= 0) {
                        sceKernelStartThread(thid, 0, 0);
              }
    
              return thid;
    }
    
    char test1 [4] = "1000";
    char test2 [4] = "2000";
    char test3 [4] = "3000";
    char test4 [4] = "4000";
    char test5 [4] = "5000";
    char test6 [4] = "6000";
    char test7 [4] = "7000";
    char test8 [4] = "8000";
    char test9 [4] = "9000";
    int x = 1; // number to find which 5 words to display
    int y = 0; // number for highlighting
    int i;
    int counter;
    Color highlightColor = RGB(200, 200, 200);
    Color dimmedColor = RGB(100, 100, 100);
    Color shadowColorH = RGB(55, 55, 55 );
    Color shadowColorD = RGB(55, 55, 55 );
    int main(void) {
    	scePowerSetClockFrequency(333, 333, 166); 
    	SetupCallbacks();
                 initGraphics(); 
    	SceCtrlData pad;
    	while (1) {
    	counter = 0;
    	for(i=x; i<x + 5; i++) { // for all 5 lines that need to be displayed
    		counter++; // which line of the 5 lines to write
    		if (i == x+y) { // if we are on a line that needs to be highlighted, display the highlighted words
    			if (i == 1) {
    				printTextScreen(30, counter*10, test1, highlightColor);
    			} else if (i == 2) {
    				printTextScreen(30, counter*10, test2, highlightColor);
    			} else if (i == 3) {
    				printTextScreen(30, counter*10, test3, highlightColor);
    			} else if (i == 4) {
    				printTextScreen(30, counter*10, test4, highlightColor);
    			} else if (i == 5) {
    				printTextScreen(30, counter*10, test5, highlightColor);
    			} else if (i == 6) {
    				printTextScreen(30, counter*10, test6, highlightColor);
    			} else if (i == 7) {
    				printTextScreen(30, counter*10, test7, highlightColor);
    			} else if (i == 8) {
    				printTextScreen(30, counter*10, test8, highlightColor);
    			} else if (i == 9) {
    				printTextScreen(30, counter*10, test9, highlightColor);
    			}
    		} else { // if not a words thats to be highlighted, display the shaded word
    			if (i == 1) {
    				printTextScreen(30, counter*10, test1, shadowColorD);
    			} else if (i == 2) {
    				printTextScreen(30, counter*10, test2, shadowColorD);
    			} else if (i == 3) {
    				printTextScreen(30, counter*10, test3, shadowColorD);
    			} else if (i == 4) {
    				printTextScreen(30, counter*10, test4, shadowColorD);
    			} else if (i == 5) {
    				printTextScreen(30, counter*10, test5, shadowColorD);
    			} else if (i == 6) {
    				printTextScreen(30, counter*10, test6, shadowColorD);
    			} else if (i == 7) {
    				printTextScreen(30, counter*10, test7, shadowColorD);
    			} else if (i == 8) {
    				printTextScreen(30, counter*10, test8, shadowColorD);
    			} else if (i == 9) {
    				printTextScreen(30, counter*10, test9, shadowColorD);
    			}
    		}
    	}
    	sceCtrlReadBufferPositive(&pad, 1);
    	if (pad.Buttons & PSP_CTRL_UP) {
    		if ((x > 1) & (y == 2)) { // if up button pressed and we are not at top of page and the highlighted word is the middle word
    			x -= 1; // scroll up
    		} else if (y > 0) { // if at top of the page or highlighted word is not in middle of scrollbar
    			y -= 1; // highlight word abouve this one
    		}
    	} else if (pad.Buttons & PSP_CTRL_DOWN) { // reverse as up
    		if ((x < 5) & (y == 2)) {
    			x += 1;
    		} else if (y < 4) {
    			y += 1;
    		}
    	}
    			
    
    	flipScreen();
    	clearScreen(0);
    	for(i=0; i<10; i++) {
    		sceDisplayWaitVblankStart();
    	}
    	}
        return 0;
    }

  22. #2362
    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 the unique warrior
    please don't edit the SDK if you don't know how to...
    so hallo007 use SE-SDK with the real SDK don't change it!
    Thanks,
    TUW
    how do you do that??
    justput it in pspdev??
    sdk/
    HENsdk/
    -= Double Post =-
    how doyou let the user select an file in a map if you dont know wich files and how any files there are in
    (like an mpplayer)
    Geändert von hallo007 (12-16-2006 um 05:38 AM Uhr) Grund: Automerged Doublepost

  23. #2363
    QJ Gamer Silver
    Points: 7.385, Level: 57
    Level completed: 18%, Points required for next Level: 165
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Finland
    Beiträge
    752
    Points
    7.385
    Level
    57
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    As for the indenting, i do it automatically since it makes my code structured in a sense, and i can easily go back and forth without getting lost in nested loops and whatnot. I dont see how TUW gets anything efficiently done ;) jk
    Yeah, exactly :P
    wheeee =:D

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

    Zitat Zitat von zwnage
    ....
    That didn't give you warnings or errors?
    Code:
    char test1 [4] = "1000";
    char test2 [4] = "2000";
    char test3 [4] = "3000";
    char test4 [4] = "4000";
    char test5 [4] = "5000";
    char test6 [4] = "6000";
    char test7 [4] = "7000";
    char test8 [4] = "8000";
    char test9 [4] = "9000";
    The array is not large enough for the strings as it doesn't have enough room for a null terminator.

    Switch it to:
    Code:
    char test1 [] = "1000";
    char test2 [] = "2000";
    char test3 [] = "3000";
    char test4 [] = "4000";
    char test5 [] = "5000";
    char test6 [] = "6000";
    char test7 [] = "7000";
    char test8 [] = "8000";
    char test9 [] = "9000";

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

    Or, to put it another way... Every character array must be terminated by a NULL char. that char is '\0'. By not setting a character array's size on declaration, anything you initializing it to, will automatically size the array to how ever amny chars there are + 1 null terminating char...

    You could have also just changed the 4 to 5 as the size of the arrays. But, if you plan to make a 5 digit number or word in the strings anywhere, best increase it to whatever you need (5 digits = 6, 6 digits = 7, etc.)

    But heads way is perfect (saves you time counting)

    ...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. #2366
    QJ Gamer Green
    Points: 9.253, Level: 64
    Level completed: 68%, Points required for next Level: 97
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Australia - A.C.T.
    Beiträge
    1.517
    Points
    9.253
    Level
    64
    Downloads
    0
    Uploads
    0

    Standard

    ok how would i go about making an app which can go from plain text to ascii and back the other way is there any straight forward code or would it be quite complex to code?

    how hard would it be to port this code over it looks very much like C (i know it's java script)
    Spoiler for CODE:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
    "http://www.w3.org/TR/REC-html40/loose.dtd">
    <html>
    <head>
    <title>Convert text to ASCII - Get Your Website Here!</title>
    <script language="javascript">
    <!--
    
    //Comments Section
    //Jim Allen email: [email protected] 
    //The Convert ASCII to text utility and its html and javascript code are
    //copyright 2002 by Thomas James Allen
    
    //test for various browsers
    var browsertype = "IE4x"
    if (document.all){browsertype = "IE4x"}else{}
    if (document.layers){browsertype = "NN4x"}else{}
    if (navigator.appVersion.indexOf("MSIE 5", 0) != -1){browsertype = "IE5xDOM"}else{}
    if (navigator.appName == "Netscape" && 
    parseInt(navigator.appVersion) >= 5){browsertype = "NN6xDOM"}else{}
    
    //character tables
    mycarii = new Array()
    myaskii = new Array()
    //small letters
    mycarii[1] = "a"; myaskii[1] = "a"
    mycarii[2] = "b"; myaskii[2] = "b"
    mycarii[3] = "c"; myaskii[3] = "c"
    mycarii[4] = "d"; myaskii[4] = "d"
    mycarii[5] = "e"; myaskii[5] = "e"
    mycarii[6] = "f"; myaskii[6] = "f"
    mycarii[7] = "g"; myaskii[7] = "g"
    mycarii[8] = "h"; myaskii[8] = "h"
    mycarii[9] = "i"; myaskii[9] = "i"
    mycarii[10] = "j"; myaskii[10] = "j"
    mycarii[11] = "k"; myaskii[11] = "k"
    mycarii[12] = "l"; myaskii[12] = "l"
    mycarii[13] = "m"; myaskii[13] = "m"
    mycarii[14] = "n"; myaskii[14] = "n"
    mycarii[15] = "o"; myaskii[15] = "o"
    mycarii[16] = "p"; myaskii[16] = "p"
    mycarii[17] = "q"; myaskii[17] = "q"
    mycarii[18] = "r"; myaskii[18] = "r"
    mycarii[19] = "s"; myaskii[19] = "s"
    mycarii[20] = "t"; myaskii[20] = "t"
    mycarii[21] = "u"; myaskii[21] = "u"
    mycarii[22] = "v"; myaskii[22] = "v"
    mycarii[23] = "w"; myaskii[23] = "w"
    mycarii[24] = "x"; myaskii[24] = "x"
    mycarii[25] = "y"; myaskii[25] = "y"
    mycarii[26] = "z"; myaskii[26] = "z"
    //caps
    mycarii[27] = "A"; myaskii[27] = "A"
    mycarii[28] = "B"; myaskii[28] = "B"
    mycarii[29] = "C"; myaskii[29] = "C"
    mycarii[30] = "D"; myaskii[30] = "D"
    mycarii[31] = "E"; myaskii[31] = "E"
    mycarii[32] = "F"; myaskii[32] = "F"
    mycarii[33] = "G"; myaskii[33] = "G"
    mycarii[34] = "H"; myaskii[34] = "H"
    mycarii[35] = "I"; myaskii[35] = "I"
    mycarii[36] = "J"; myaskii[36] = "J"
    mycarii[37] = "K"; myaskii[37] = "K"
    mycarii[38] = "L"; myaskii[38] = "L"
    mycarii[39] = "M"; myaskii[39] = "M"
    mycarii[40] = "N"; myaskii[40] = "N"
    mycarii[41] = "O"; myaskii[41] = "O"
    mycarii[42] = "P"; myaskii[42] = "P"
    mycarii[43] = "Q"; myaskii[43] = "Q"
    mycarii[44] = "R"; myaskii[44] = "R"
    mycarii[45] = "S"; myaskii[45] = "S"
    mycarii[46] = "T"; myaskii[46] = "T"
    mycarii[47] = "U"; myaskii[47] = "U"
    mycarii[48] = "V"; myaskii[48] = "V"
    mycarii[49] = "W"; myaskii[49] = "W"
    mycarii[50] = "X"; myaskii[50] = "X"
    mycarii[51] = "Y"; myaskii[51] = "Y"
    mycarii[52] = "Z"; myaskii[52] = "Z"
    //numerals
    mycarii[53] = "0"; myaskii[53] = "0"
    mycarii[54] = "1"; myaskii[54] = "1"
    mycarii[55] = "2"; myaskii[55] = "2"
    mycarii[56] = "3"; myaskii[56] = "3"
    mycarii[57] = "4"; myaskii[57] = "4"
    mycarii[58] = "5"; myaskii[58] = "5"
    mycarii[59] = "6"; myaskii[59] = "6"
    mycarii[60] = "7"; myaskii[60] = "7"
    mycarii[61] = "8"; myaskii[61] = "8"
    mycarii[62] = "9"; myaskii[62] = "9"
    //punctuation too
    mycarii[63] = " "; myaskii[63] = " "
    mycarii[64] = "\!"; myaskii[64] = "!"
    mycarii[65] = "\""; myaskii[65] = """
    mycarii[66] = "\#"; myaskii[66] = "#"
    mycarii[67] = "\$"; myaskii[67] = "$"
    mycarii[68] = "\%"; myaskii[68] = "%"
    mycarii[69] = "\&"; myaskii[69] = "&"
    mycarii[70] = "\'"; myaskii[70] = "'"
    mycarii[71] = "\("; myaskii[71] = "("
    mycarii[72] = "\)"; myaskii[72] = ")"
    mycarii[73] = "\*"; myaskii[73] = "*"
    mycarii[74] = "\+"; myaskii[74] = "+"
    mycarii[75] = "\,"; myaskii[75] = ","
    mycarii[76] = "\-"; myaskii[76] = "-"
    mycarii[77] = "\."; myaskii[77] = "."
    mycarii[78] = "\/"; myaskii[78] = "/"
    //more punctuation
    mycarii[79] = "\:"; myaskii[79] = ":"
    mycarii[80] = "\;"; myaskii[80] = ";"
    mycarii[81] = "\<"; myaskii[81] = "&#60"
    mycarii[82] = "\="; myaskii[82] = "="
    mycarii[83] = "\>"; myaskii[83] = "&#62"
    mycarii[84] = "\?"; myaskii[84] = "?"
    mycarii[85] = "\@"; myaskii[85] = "@"
    mycarii[86] = "\["; myaskii[86] = "["
    mycarii[87] = "\\"; myaskii[87] = "\"
    mycarii[88] = "\]"; myaskii[88] = "]"
    mycarii[89] = "\^"; myaskii[89] = "^"
    mycarii[90] = "\_"; myaskii[90] = "_"
    mycarii[91] = "\`"; myaskii[91] = "`"
    mycarii[92] = "\{"; myaskii[92] = "{"
    mycarii[93] = "\|"; myaskii[93] = "|"
    mycarii[94] = "\}"; myaskii[94] = "}"
    mycarii[95] = "\~"; myaskii[95] = "~"
    
    //Conversion function
    function askMe(){
    if (document.convertform.yourtext.value == ""){
    alert("Paste text in the top box first"); return;}else{};
    var theirText = document.convertform.yourtext.value;
    var theirConverted = "";
    var inTag = false;
    //convert characters into ascii equivalents
    for(i=0; i<=theirText.length-1; i++){
        hari = "zzz";
        cari = theirText.charAt(i);
        if((cari == "\<") && (document.convertform.cb.checked)){inTag = true}else{}
        //searching for ascii value for each character
        for(j=1; j<=95; j++){
        if (cari == mycarii[j]){hari = myaskii[j];}else{}
        }
    
        //not found in my list, just put in the character
        if (hari == "zzz"){hari = cari}else{};
    
        //if in a tag
        if (inTag){
            hari = cari;
            if(cari == "\>"){inTag = false}else{}
        }else{}
        //add it on
        theirConverted += hari;
        }
    //output result
    document.convertform.yourascii.value = theirConverted;
    }
    
    function exampleMe(){
    xample = "Example with <bold>some tagged content</bold> in the middle.\n"
    xample = xample += "\n(c) by Jim Allen 2002\n"
    xample = xample += "http://getyourwebsitehere.com"
    
    document.convertform.yourtext.value = xample;
    askMe();
    }
    
    function clrMe(){
    document.convertform.yourtext.value = "";
    document.convertform.yourascii.value = "";
    }
    
    //-->
    </script>
    
    <style type="text/css">
    .ta {font-family:Times New Roman,serif; font-size:13px; font-style:normal; font-weight:normal}
    </style>
    
    </head>
    
    <body topmargin="0" marginheight="0" bgcolor="#fff8dc">
    
    <table width="430" border="0" bgcolor="#ffcc99" cellpadding="15" cellspacing="0">
    <tr>
    <td>
    <table width="400" border="0" bgcolor="#f8f8f8" cellpadding="10" cellspacing="0">
    <tr>
    <td><span class="title">Convert Text to ASCII Utility</span><br><br>
    This javascript utility converts text into its ASCII equivalent.
    </td></tr></table>
    </td></tr></table>
    <br>
    <table width="600" border="0" bgcolor="#ffcc99" cellpadding="15" cellspacing="0">
    <tr>
    <td>
    <table width="570" border="0" bgcolor="#f8f8f8" cellpadding="10" cellspacing="0">
    <tr>
    <td class='ta'><br>
    <script language="JavaScript"><!-- 
    //this section prints the textboxes right-sized for your browser
    document.write("<form name='convertform'>");
    if(browsertype == "NN4x"){
    document.write("<textarea class='ta' cols='50' rows='6' name='yourtext' wrap='virtual'>Paste your text into this box.</textarea>");
    }else{
    document.write("<textarea class='ta' cols='105' rows='6' name='yourtext' wrap='virtual'>Paste your text into this box.</textarea>");
    }
    document.write("<br>\n");
    document.write("<input type='checkbox' name='cb' checked> Don't convert tags.<br><br>\n");
    document.write("<input type='button' value='Convert to ASCII' onclick='askMe();'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' value='Show example' onclick='exampleMe();'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' value='Clear' onclick='clrMe();'>");
    document.write("<br><br>\n");
    if(browsertype == "NN4x"){
    document.write("<textarea class='ta' cols='50' rows='12' name='yourascii' wrap='virtual'>Your ASCII code will appear here.</textarea>");
    }else{
    document.write("<textarea class='ta' cols='105' rows='12' name='yourascii' wrap='virtual'>Your ASCII code will appear here.</textarea>");
    }
    document.write("</form>\n");
    //-->
    </script></td></tr></table>
    </td></tr></table>
    <br><br>
    
    </body>
    </html>
    Geändert von mafia1ft (12-17-2006 um 05:00 AM Uhr)

  27. #2367
    Developer
    Points: 7.058, Level: 55
    Level completed: 54%, Points required for next Level: 92
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    408
    Points
    7.058
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von head_54us
    That didn't give you warnings or errors?
    Code:
    char test1 [4] = "1000";
    char test2 [4] = "2000";
    char test3 [4] = "3000";
    char test4 [4] = "4000";
    char test5 [4] = "5000";
    char test6 [4] = "6000";
    char test7 [4] = "7000";
    char test8 [4] = "8000";
    char test9 [4] = "9000";
    The array is not large enough for the strings as it doesn't have enough room for a null terminator.
    Actually he's overallocating. It would be perfectly valid to define char test1[1] = "1000"; as the actual data is static text.

  28. #2368
    Points: 3.593, Level: 37
    Level completed: 62%, Points required for next Level: 57
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Beiträge
    11
    Points
    3.593
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Thanks for the help! I increased the array size, and it works now! Thanks a bunch, I would have never been able to find that error myself (and there was no error warnings). :)

  29. #2369
    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

    mafia1ft: Plain text is ascii

    Zitat Zitat von Samstag
    Actually he's overallocating. It would be perfectly valid to define char test1[1] = "1000"; as the actual data is static text.
    I still think he is under allocating as he is explictly allocating 4 bytes for the string whereas

    char * text = "dslkfljsf";

    Would be fine.

  30. #2370
    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

    Ok, I am new to PSP programming although I have some experience with C++.

    I am using PSP-Programming as a guide to get me started with the basics. I understand quite a bit now. My question is wtf is wrong with this!!!!!! LOL. I get an error that I dont really understand. Could someone please tell me why I get this error/s

    error: Syntax error before "}" token.

    I really need some help with this. Could someone explian to me whjy I get this error. My code is below. It is a simple image load from PSP-Programming. Help. It looks way better on Bloodshed so please bear with me. :P

    I typed all of it except a comment by hand. There may be spelling errors, but I do not see any.

    Spoiler for Hi. Im Moca. !!!!:
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    //~~~~~~~~~~~~~~~~~~~~~~~~~ ~~My First Image Display Program~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~//
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    //The people I have to thank for the creation of this include psp-programming for their wonderful//
    //Tutorials, PS2DEV for the PSPToolchain so this actually loads on the PSP, and of course //
    //TUW(The Unique Warrior) for all of his help getting me started with my programs. //
    // //
    ///////////////////////////////////////////////////////////////////////////////////////////////////
    //
    //Begin the program
    //Include Files



    #include <pspdisplay.h>
    #include <pspctrl.h>
    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <pspgu.h>
    #include <png.h>
    #include <stdio.h>
    #include "graphics.h"

    /*defines printf. Instead of having to type "pspDebugScreenPrintf " everytime I want to
    print something to the screen, I just type printf. Makes things a lot easier*/

    #define printf pspDebugScreenPrintf
    /*The below comment is the only thing I copied and pasted from psp-programming. I manually typed the rest.*/
    /*This second #define is actually defining a function;
    but it is doing it in a shorthand form.
    This type of definition is called a Macro Function.
    It accepts the parameters X and Y, and then will run them through the function,
    which basically amounts to an if statement.
    Basically, what this function will do is return the value of X
    if it is greater than Y, or the value of Y if X is less than Y.
    The syntax of a Macro Function is "NAME (TEST ? TRUE : FALSE)"
    where NAME is the identifier, TEST is the equivalent of what would go in the parenthesis of an if statement,
    TRUE is what to return if the TEST result is true, and FALSE is what to return if the TEST result is false.*/
    #define MAX(X, Y) ((X) > (Y) ? (X) : (Y))

    //Gives information about the program. Self explanatory. Just look at it.
    PSP_MODULE_INFO("Image Display Program", 0, 1, 1);

    //This goes after the PSP_MODULE_INFO. Makes the program stable. And allows you to exit with home.
    //It should be included in every program.
    /* Exit callback */
    int exit_callback(int arg1, int arg2, void *common) {
    sceKernelExitGame();
    return 0;
    }

    /* Callback thread */
    int CallbackThread(SceSize args, void *argp) {
    int cbid;

    cbid = sceKernelCreateCallback(" Exit Callback", exit_callback, NULL);
    sceKernelRegisterExitCall back(cbid);

    sceKernelSleepThreadCB();

    return 0;
    }

    /* Sets up the callback thread and returns its thread id */
    int SetupCallbacks(void) {
    int thid = 0;

    thid = sceKernelCreateThread("up date_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
    if(thid >= 0) {
    sceKernelStartThread(thid , 0, 0);
    }

    return thid;
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////Now lets separate the above part to make things look pretty/////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //Start main() function//

    int main() {
    char buffer[200];
    Image* ourImage;

    pspDebugScreenInit();
    SetupCallbacks();
    initGraphics();

    sprintf(buffer, "ourImage.png");
    ourImage = loadImage(buffer);

    if (ourImage) {
    //Image load unsuccessful
    printf("Image Load Unsuccessful! \n")
    } else {

    int x = 0;
    int y = 0;
    sceDisplayWaitVblankStart ();

    while (x < 480) {
    while (y < 272) {

    blitAlphaImageToScreen(0 ,0 ,32 , 32, ourImage, x, y);
    y += 32;
    }
    x += 32;
    y = 0;
    }

    flipScreen();
    }

    sceKernelSleepThread();
    return 0;
    }
    [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]


 

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 .