Nevermind, I have figured it out.
Type: Posts; User: coderplus
Nevermind, I have figured it out.
It has nothing to do with homework.
And I posted the code I was working on.
OK so if I had:
for( itm=mymap.begin(); itm!=mymap.end(); ++itm)
{
cout << "first: \t" << it->first << endl;
}
Yes, of course it can iterate fine over the first map but I want to iterate over the second map. :)
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.
Hi,
I have a problem trying to iterate over a multimap (or rather map within map).
I have this:
#include <map>
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++){...
Ahah, got it. Thanks.
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;
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?
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...
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...
Alright I tried it out.
DWORD SAM,TAN;
GetProcessAffinityMask(hThreads[1],&SAM,&TAN);
tp1 = SetProcessAffinityMask(hThreads[1],0);
tp2 = SetThreadAffinityMask(hThreads[1],3);
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);...
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...
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?
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...
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...
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;...
It still should work properly.
And if I don't use it, what else will I use to read it correct?
Windows XP/7.
Its a regular text file so "f = fopen("textfile.txt", "r");".
Its always off by 1-7 maybe 1-10bytes.
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,...
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))?
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...
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");