Search:

Type: Posts; User: coderplus

Search: Search took 0.01 seconds.

  1. Replies
    9
    Views
    1,003

    Nevermind, I have figured it out.

    Nevermind, I have figured it out.
  2. Replies
    9
    Views
    1,003

    It has nothing to do with homework. And I...

    It has nothing to do with homework.

    And I posted the code I was working on.
  3. Replies
    9
    Views
    1,003

    OK so if I had: for( itm=mymap.begin();...

    OK so if I had:



    for( itm=mymap.begin(); itm!=mymap.end(); ++itm)

    {
    cout << "first: \t" << it->first << endl;

    }
  4. Replies
    9
    Views
    1,003

    Yes, of course it can iterate fine over the first...

    Yes, of course it can iterate fine over the first map but I want to iterate over the second map. :)
  5. Replies
    9
    Views
    1,003

    That is obvious. As per example I have given,...

    That is obvious.

    As per example I have given, iterating over a normal map, trying to produce the same results with a map within a map doesn't work.
  6. Replies
    9
    Views
    1,003

    Iterating over multi map

    Hi,

    I have a problem trying to iterate over a multimap (or rather map within map).

    I have this:



    #include <map>
  7. Replies
    1
    Views
    913

    C++ map problem

    Hi,

    I have a small problem with a std::map. Whenever I run it in a loop the values only get updated, it doesn't insert new values for some reason.

    I did a simple test:



    for (i=0;i<3;i++){...
  8. Replies
    4
    Views
    973

    Ahah, got it. Thanks.

    Ahah, got it. Thanks.
  9. Replies
    4
    Views
    973

    command line args problem

    I have a problem checking on the command line args.



    int main(int argc, char* argv[])
    {
    printf("%s",argv[1]);
    if (argv[1]=="hello")
    printf("works!");
    return 0;
  10. Replies
    4
    Views
    1,452

    Oh ok, than I think I know a good way to do it. ...

    Oh ok, than I think I know a good way to do it.

    Can you btw generate or make them dynamically? After compilation, while it is running. Or is that also not possible?
  11. Replies
    4
    Views
    1,452

    getting size of int/char array

    How can I get the size of a multidimensional int/char array?



    int array[80][80]= {{1,2,3},{4,5,6,7},{8,9,10,11,12}};


    If I have that as example.

    How can I get it to return the actual...
  12. Oh, that is unfortunate. I have looked at the...

    Oh, that is unfortunate.

    I have looked at the functions. But how do I even retrieve or know what to fill in as "HANDLE hProcess"?

    Do I use "GetCurrentProcess" for this? And in what form does it...
  13. Alright I tried it out. DWORD SAM,TAN;...

    Alright I tried it out.



    DWORD SAM,TAN;
    GetProcessAffinityMask(hThreads[1],&SAM,&TAN);
    tp1 = SetProcessAffinityMask(hThreads[1],0);
    tp2 = SetThreadAffinityMask(hThreads[1],3);
  14. Forcing thread to run on specific processor

    I am trying to run my threads on specified cores.




    HANDLE hThreads[2];
    hThreads[0] = (HANDLE)_beginthread(threadn,0,NULL);
    hThreads[1] = (HANDLE)_beginthread(threadm,0,NULL);...
  15. Replies
    10
    Views
    1,191

    Yes the files will only be under 10mb size. If...

    Yes the files will only be under 10mb size. If they will get larger I will read it in the loop format I guess yes.

    PS. I forgot to mention earlier that whenever I don't '\0' the data that it...
  16. Replies
    10
    Views
    1,191

    OK, so I just replace the str functions by loops...

    OK, so I just replace the str functions by loops of 16byte data doing?


    textbuf[i] = encrypt[i];

    But I still read the entire file at the beginning right, not 16byte at a time?
  17. Replies
    10
    Views
    1,191

    The result is the same when I run the program....

    The result is the same when I run the program. Additional whenever I print the decrypted buffer it doesn't print the entire section and it seems to be still encrypted plus always I see the same data...
  18. Replies
    10
    Views
    1,191

    The only code that I have before it is just...

    The only code that I have before it is just reading the encrypted file. Its nothing special.

    I changed the loop to:



    dbuf = malloc((strlen(fbuffer)));
    dbuf[(strlen(fbuffer))] = '\0';
    for...
  19. Replies
    10
    Views
    1,191

    AES implementation not working

    I made a simple AES implementation but it fails to parse data above 100byte for some reason.


    char *dbuf;
    dbuf = malloc(10240000);
    in = 0;
    n = (strlen(fbuffer)) / 16; //cycle times
    for (j=0;...
  20. Replies
    7
    Views
    852

    It still should work properly. And if I don't...

    It still should work properly.

    And if I don't use it, what else will I use to read it correct?
  21. Replies
    7
    Views
    852

    Windows XP/7. Its a regular text file so "f =...

    Windows XP/7.

    Its a regular text file so "f = fopen("textfile.txt", "r");".

    Its always off by 1-7 maybe 1-10bytes.
  22. Replies
    7
    Views
    852

    Cannot read correct file size

    For some reason whenever I read a file it always adds garbage add the end. I can't figure out why.


    fseek(f, 0, SEEK_END);
    long s = ftell(f);
    rewind(f);
    fbuffer = malloc(s);
    fread(fbuffer, 1,...
  23. Replies
    6
    Views
    1,037

    OK, so what changes do I make to my program? ...

    OK, so what changes do I make to my program?

    Or is "buffer" already what you said it should be with the way salem described (buffer = malloc(s))?
  24. Replies
    6
    Views
    1,037

    Wow, that was easier to fix than I thought. :)...

    Wow, that was easier to fix than I thought. :)
    Thanks.


    But how do I read a file larger than 50mb lets say if I can only use a small buffer?

    I need to end up with the stuff that it reads...
  25. Replies
    6
    Views
    1,037

    Reading file from offset

    I need some help reading a file from an offset till end of file.

    I tried this but it didn't work.



    int i,sizeb=210;
    char *buffer; //[1024];
    FILE *f;
    f = fopen("myfile", "rb");
Results 1 to 25 of 25