Search:

Type: Posts; User: agentsmith

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    11
    Views
    4,613

    Thanks rag_to_riches. It all seems to work now!!...

    Thanks rag_to_riches. It all seems to work now!! I will add more string arrays and test it.
    Thanks a lot!!!
  2. Replies
    11
    Views
    4,613

    Ok now I understand that bit, but how do I solve...

    Ok now I understand that bit, but how do I solve the bus error problem?? Whenever, I pass it something like "lw" or "addi", which are both not in the first array I keep getting Bus Error and I don't...
  3. Replies
    11
    Views
    4,613

    Hi. I know this is an old post but I have been...

    Hi. I know this is an old post but I have been unsuccessful at trying to implement the above code by dwks. At first I tried it out and it seemed only to work when I passed it a string that was...
  4. Replies
    11
    Views
    4,613

    help with switch statement

    can this chuck of if-else if statements can be converted into switch statement format? thanks


    int search_opcode (char opcode[LENGTH])
    {
    if (( strcmp ("add", opcode) == 0) || (strcmp...
  5. Replies
    3
    Views
    1,200

    Thanks a lot, now it all works. Just shows that...

    Thanks a lot, now it all works. Just shows that it's not always good idea to follow the guidelines your lecturer gives you, since obviously his code is blatantly wrong lol.
  6. Replies
    3
    Views
    1,200

    simple list question

    #include <stdio.h>
    #include <ctype.h>
    #include <stdlib.h>
    #include <string.h>


    typedef struct List {char array[10]; struct List *next;} List;

    List *insert_list (char head[10], List *tail)
    {
  7. Replies
    1
    Views
    1,624

    simple array question

    Hi, i am trying am dealing with numbers in two's complement. If I pass a negative number to the function, it turns it into positive and works out its binary equivalent. The bit I am stuck on is...
  8. Replies
    1
    Views
    1,230

    Array misbehaving

    In my code I initialize an array of 32 ints to 0. From then on, depending on the string passed to the function, appropriate array elements are changed to 1. Here is my code so far:


    #include...
  9. Thanks. Now once its in the file do I treat it as...

    Thanks. Now once its in the file do I treat it as a string when retrieving it?
  10. how to handle ints and strings when writing to file

    Is it possible for one array to contain a string and few ints?? I want to write to a text file a string followed by a few ints, so they all appear on the same line in the file. Example of what I want...
  11. Replies
    3
    Views
    1,310

    Great. I set i = 0 in check_for_label() and it...

    Great. I set i = 0 in check_for_label() and it all works. Thanks guys
  12. Replies
    3
    Views
    1,310

    help with pointers and ints

    I am writing code that searches a string for a specified character and returns its position in the array. Here's my code so far:


    #include <stdio.h>
    #include <string.h>

    int check_for_label...
  13. Replies
    4
    Views
    1,230

    cheers, all fixed now

    cheers, all fixed now
  14. Replies
    4
    Views
    1,230

    help with simple question

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ctype.h>

    void search_array (char array[], char type)
    {
    if (strcmp ("nop", array) == 0){
    type = 'R';
    ...
  15. Replies
    3
    Views
    3,472

    Ok then, suppose instead of a binary file I...

    Ok then, suppose instead of a binary file I simply copy characters from one text file into another, whilst removing spaces between them (but blank lines still present).

    My problem is that if the...
  16. Replies
    3
    Views
    3,472

    help with fgetc

    Is it possible to make fgetc skip to a new line once it encounters a certain character? Here is my code so far:


    #include <stdio.h>
    #include <ctype.h>
    #include <stdlib.h>

    FILE *gfopen (char...
  17. Dealing with whitespaces whilst reading a file

    The aim of my code is to read in a code in a text file and discard comments, i.e. any characters after '#'. So for example, line like this:


    main: addi $3,$0,40 # j = 40

    is transformed...
  18. Replies
    1
    Views
    2,042

    manipulating fgetc while reading a file

    i am writing code that basically reads in a text file and only reads in code up to a certain character. It's a simple assembler that needs to read in assembly code whilst discarding comments that...
  19. Replies
    5
    Views
    3,085

    cheers i fixed it

    cheers i fixed it
  20. Replies
    5
    Views
    3,085

    problem with strings

    my code converts binary into hexadecimal. I pass an array that contains a string 0s and 1s to the function and it converts it to a string of characters that represent the hexadecimal value. The...
  21. Replies
    3
    Views
    1,109

    cool, cheers. I fixed it now. Thanks for help....

    cool, cheers. I fixed it now. Thanks for help. However, I am a bit confused about arrays. I know that for a string you need an extra array element to hold "\0" but do I have to leave an extra element...
  22. Replies
    3
    Views
    1,109

    help with strings

    My code reads in a number, then produces that number in binary and converts it to string of chars. The code works correctly, however, when I run it in Mac OS X terminal my output doesn't match the...
  23. Replies
    10
    Views
    2,331

    global variable confusion

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ctype.h>
    #include <time.h>

    #define LEN 20 /* word array size */
    #define HASHSIZE 12289 /* hash table size */

    typedef...
  24. Replies
    15
    Views
    8,812

    yeah it is a SAX hash. thanks a lot guys

    yeah it is a SAX hash. thanks a lot guys
  25. Replies
    15
    Views
    8,812

    cheers. then how would i properly describe this...

    cheers. then how would i properly describe this execution in the hash function?


    h ^= ( h << 5 ) + ( h >> 2 ) + p[i];

    i know it has something to do with shifting but beyond that i have no clue
Results 1 to 25 of 67
Page 1 of 3 1 2 3