Search:

Type: Posts; User: dhuan

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Thread: Pointer Issue

    by dhuan
    Replies
    8
    Views
    1,344

    What I was trying to do is, when I assigned...

    What I was trying to do is, when I assigned 0x101112 to an address in memory, I thought it would first assign to 0x10 to the first element of the array, then 0x11 to the second element and so on. All...
  2. Thread: Pointer Issue

    by dhuan
    Replies
    8
    Views
    1,344

    Thought it had something to do with endianess....

    Thought it had something to do with endianess. Guess I was on the wrong track, thanks for your explanation, grumpy
  3. Replies
    2
    Views
    977

    Question regarding integers and chars

    #include <iostream>

    using namespace std;

    int main()
    {
    char * c = new char[1];
    *(c+0) = 0x10;
    *(c+1) = 0x11;
    unsigned int i = *(c);
  4. Thread: Pointer Issue

    by dhuan
    Replies
    8
    Views
    1,344

    Pointer Issue

    #include <iostream>

    using namespace std;

    int main()
    {
    char * c = new char[2];
    *c = 0x101112;
    unsigned int i = *(c);
    cout << i;
  5. Replies
    5
    Views
    1,094

    You mean, using FILE data type instead of fstream...

    You mean, using FILE data type instead of fstream class?



    So instead of "new char[lenght]", I would have to use something like "new char[lenght + 1]", since '\0' takes 1 byte, correct?


    ...
  6. Replies
    5
    Views
    1,094

    Dealing with files thru FILE *

    After doing some reading on FILE data type I decided to practice, I came up with this little program that reads any part of any file:



    #include <iostream>
    #include <string>
    #include <stdio.h>...
  7. Replies
    4
    Views
    1,051

    Bump

    Bump
  8. Replies
    4
    Views
    1,051

    Please, give me an example. How could I...

    Please, give me an example.



    How could I not have seen it before. Thanks. I'll apply it to my code.



    Yeh, I'm sure there's many ways of doing this much better than what I did, that's why...
  9. Replies
    4
    Views
    1,051

    Hex String Function

    What this function (hex_str) does is, it receives a 1-byte char as argument, and returns its hex representation as string.

    I'd like some tips on how to improve my code.



    #include <iostream>...
  10. Replies
    1
    Views
    1,522

    LZ77 Match Searching (HELP!)

    I've learned LZ77 in theory, know I wanna practice, my first attempt was to code a C++ function that finds the best match when comparing the sliding window with the look ahead buffer, this is what i...
  11. Replies
    3
    Views
    992

    Bump

    Bump
  12. Replies
    3
    Views
    992

    Archive Manipulation

    Let's say i have a simple archive file, i've figured its format, headers etc ) thru hexadecimal editor.
    Now whats the best approach for manipulating it in C++, like inserting a new file on it,...
  13. Replies
    1
    Views
    940

    Calculations Issue

    This is its objective:

    It asks for the name and salary of a specific number of employees... Then it calculates and tells the user the average salary of the company, then it says who's the richest...
  14. Thread: X-Encrypter

    by dhuan
    Replies
    2
    Views
    1,193

    Bump

    Bump
  15. Thread: X-Encrypter

    by dhuan
    Replies
    2
    Views
    1,193

    X-Encrypter

    After reading a tutorial on XOR encryption at cplusplus.com I decided to code
    this super program called X-Encrypter, just so I can practice what I've learned
    from tutorials.
    This is what it does:...
  16. Replies
    5
    Views
    1,478

    Works fine, but when the key string is one or two...

    Works fine, but when the key string is one or two characters long my CPU beeps.
    Why does that happen?



    #include <iostream>
    #include <string>

    using namespace std;
  17. Replies
    5
    Views
    1,478

    I dont understand. How does the modulo operator...

    I dont understand. How does the modulo operator help?
  18. Replies
    5
    Views
    1,478

    Xor Encryption Issue

    Is this a valid xor encryption function?


    #include <iostream>
    #include <string>

    using namespace std;

    void xorEncrypt(string& str, string key)
    {
  19. Thread: int2bin()

    by dhuan
    Replies
    2
    Views
    4,694

    int2bin()

    This function returns a binary representation in string form, of a given integer.



    #include <iostream>
    #include <string>

    using namespace std;

    string int2bin(int num)
  20. Thread: Bit Flags Issue

    by dhuan
    Replies
    3
    Views
    1,075

    still, it's not clear to me why the OR bit...

    still, it's not clear to me why the OR bit operator doesnt work as it should.

    I'll even write a simpler code that makes the compiler reports the same error message:


    #include <iostream>...
  21. Thread: Bit Flags Issue

    by dhuan
    Replies
    3
    Views
    1,075

    Bit Flags Issue

    After finishing reading a tutorial on bit flags, i decided to do some practicing.

    Here's what I came up with:


    #include <iostream>
    #include <string>

    using namespace std;
  22. Replies
    4
    Views
    2,445

    Bitwise input/output

    I'm reading about bit input/output on this link:
    Bit input/output

    It says:


    But then:
  23. Replies
    15
    Views
    15,294

    laserlight, thank you! I could never figure out...

    laserlight, thank you! I could never figure out that the solution to this problem was a simple c_str() function that trasnforms the c++ string into a dummie c char.

    Now, my next question is: how...
  24. Replies
    15
    Views
    15,294

    Another question, why can't the fstream...

    Another question, why can't the fstream constructor accept a string as the filename?

    Here's what I tried:



    string fileName;
    cout<<"FILE:";
    cin>>fileName;
    fstream...
  25. Replies
    15
    Views
    15,294

    I still havent figured out how to write hex value...

    I still havent figured out how to write hex value to the file...

    here's what i tried:


    myFile.put(0xFF,1);

    i only accepts char type data as argument...
Results 1 to 25 of 56
Page 1 of 3 1 2 3