wow you guys are good. i just can't think like that ;)
thanks a bunch.
keith
Type: Posts; User: keithmolo
wow you guys are good. i just can't think like that ;)
thanks a bunch.
keith
is it possible to round to the next highest multiple of four? for example:
if i have the values:
1.6, 2.3, 3.4, 3.9 - all of them need to be 4.
4.1, 5.6, 6.3 - all of them need to be 8.
...
nevermind. i'm dumb, and figured out my problem. thanks :)
so right now i am reading in four characters at a time from my input file. my problem happens when there is only one character to read. I need to initialize these other three characters so they...
Hi. I have just changed my while loop (an eof check) to a for loop.
for (j=0; j<size2; j++){
fIn2.read(xCh,4);
fout.write(xCh,4);
fIn2.seekg(12,ios_base::cur);
}
oh yeah, i figured this out a while ago.
combine = ((unsigned int) (unsigned char)Cha<<8) | (unsigned int) (unsigned char)Chb;
hi, i have created an array, but i am still using it inefficiently. can anyone help me make this code more efficient?
fIn2.get(xCh[0]);
fIn2.get(xCh[1]);
fIn2.get(xCh[2]);...
for testing purposes of my code, i created a dat file with the following hex code:
------------------------------------------------------------------
01 02 03 04 05 06 07 08 :: F8 F9 FA FB FC FD...
i tried these methods (at least i think i did them right), and i'm still getting the same repeat of the last result at the end. here is the code i am doing now. i want to read in every two...
I am using eof in a while loop, and it is reading in one extra time at the true end of file, resulting in repeated data.
I read the other posts on this, but could not figure out how to use...
could you please explain how this works? I understand the unpacking part, but am unfamiliar with what values the chars would be taking on. Also, what does the & do in this particular case?
...
hi everyone.
right now i have read in two characters and combined them into an int. Once i have combined them, i have shifted the whole thing over.
Now i need to take the combined shift and...
oooh awesome, OR'ing was going to be a question later on!
but i tried using write(&combine,2) and got the following error when compiling:
'write' : cannot convert parameter 1 from 'int *' to...
hrm. when i use this method:
while(!fIn2.eof()) {
fIn2.get(A);
fIn2.get(B);
combine = ((int)A<<8) | (int)B;
fout.put(combine);
it seems to be printing out every other int, rather than...
hrm. i tried both these methods and they don't seem to give me the results i'm looking for. i'm probably just dumb and am missing something basic, but here is what i DO have:
i have two ints.
...
hrm. maybe it would help if i posted code.
int a, b;
char xCha, xChb;
int combine;
fIn2.open(userfilename.c_str(), ios::in | ios::binary);
fIn2.seekg(ios::beg);
fIn2.seekp(1000);...
ok, little bit of a problem here.
I am reading in chars, x and y. once read, i need to print them out as y, x.
I have an int Z which i need to contain y AND x without adding them. so if x...
alrighty. say i have to read a lot of bytes (and i do) and switch every two around....what kind of code am i looking at? any short example-code would help a ton.
thanks,
keith
I am reading my input file one byte at a time and writing each character to my output file, like so:
while(!fIn2.eof()) {
while (fIn2.get(xCh)){
fout.put(xCh);
}
The problem...
Thanks, all. this helped mucho!
keith
Say I have something like the following:
int total_after_data = x - 44;
is there anyway to make total_after_data convertible to hex, and printable like the following?
*(long*)ib =...
if anyone can help, it would be appreciated.
i have opened up a file for input. this input file is then read from byte 1000 til the end, and then a byte count is calculated (x). After this, i...
Most excellent!
Thanks SO much for all your help, this worked, and i think that's it for now.
keith
ok. ALMOST there!
when i compile this, i get gibberish for everything except for a 2D wherever i put 0x2D in the array. this is correct, but if i put anything longer than 2D, like
0x2D003EE0...
ok, this isn't working for me. i get an error when i compile. perhaps you could look at my code and see what i am doing wrong (something stupid, probably). here is a copy of the error for the...