Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - 64-bit integers in C? | |
Pages: 1 2Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 3197/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 02-12-05 03:15 AM Link | Quote
Poop, I completely missed that. Didn't think it would cause an overflow though.

Say, is there a way to specify a shortcut key in Textpad that will run a program in the directory the current file is in? It'd be nice to not have to switch windows back and forth to compile. (Yeah, I'm lazy. ) And also if it wouldn't crash when clicking Manage Files or Customize Toolbars.

[edit] Also, I changed b to a double (yes, I did the casting and such... printing doubles as %I64d gives weird results )... It works, but I'm just wondering if this might cause some problems? I've heard some systems do floating-point math differently than others, particularly with comparing to integers.


(edited by HyperHacker on 02-11-05 11:26 PM)
Parasyte

Bullet Bill
Level: 35

Posts: 289/514
EXP: 267348
For next: 12588

Since: 05-25-04

Since last post: 104 days
Last activity: 32 days
Posted on 02-12-05 04:30 AM Link | Quote
Why on earth would you want to print a double as a base-10 integer? Hex, I can understand.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 3203/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 02-12-05 04:37 AM Link | Quote
If you mean printing them with %I64d, that was an accident. I changed it to %1.2f, works fine. I just wanted actual decimals. If a program told you a file was 6 GB and it was actually 6.89, you'd probably be rather upset, especially if you're downloading it on a slow connection or low on HD space.
neotransotaku

Baby Mario
戻れたら、
誰も気が付く
Level: 87

Posts: 2157/4016
EXP: 6220548
For next: 172226

Since: 03-15-04
From: Outside of Time/Space

Since last post: 11 hours
Last activity: 1 hour
Posted on 02-12-05 04:42 AM Link | Quote
HH, for textpad, take a look at the settings they have for Java (install the java shortcuts even if you don't have it). Just do the same thing for gcc.


(edited by neotransotaku on 02-12-05 12:43 AM)
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 3220/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 02-12-05 09:08 PM Link | Quote
Cool, found it. Is it possible to force a specific font and width (IE wrap at 80 characters) for the Command Results though? My makefiles tend to use extended DOS characters and rely on the wrapping style the DOS box uses (mainly for separating program output from compiler output) so they look rather crappy in Textpad.
neotransotaku

Baby Mario
戻れたら、
誰も気が付く
Level: 87

Posts: 2172/4016
EXP: 6220548
For next: 172226

Since: 03-15-04
From: Outside of Time/Space

Since last post: 11 hours
Last activity: 1 hour
Posted on 02-13-05 01:06 AM Link | Quote
You can change the font by going to Tools->Preferences. In the resulting dialog box, there should be a node called "Document Classes" and under it should be "C/C++". Within C/C++ there should be node called Font and there you can change the font.

As for force wrapping, in the Command Results, I don't think so...
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 3238/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 02-13-05 02:29 AM Link | Quote
Er, I meant a specific font for the command results.

So what exactly would make MessageBox() not work? Even something as simple as MessageBox(0,"Message box!","Title bar!",0) just makes the box sound and hangs the program, but no box appears.

And how do I make the window not show up in the taskbar?


(edited by HyperHacker on 02-12-05 10:58 PM)
neotransotaku

Baby Mario
戻れたら、
誰も気が付く
Level: 87

Posts: 2178/4016
EXP: 6220548
For next: 172226

Since: 03-15-04
From: Outside of Time/Space

Since last post: 11 hours
Last activity: 1 hour
Posted on 02-13-05 03:46 AM Link | Quote
I believe you have to change the default class's font to effect the command results...
Parasyte

Bullet Bill
Level: 35

Posts: 291/514
EXP: 267348
For next: 12588

Since: 05-25-04

Since last post: 104 days
Last activity: 32 days
Posted on 02-13-05 04:11 AM Link | Quote
You should always use a button definition with MessageBox:

MessageBox(NULL,"Message box!","Title bar!",MB_OK);
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 3239/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 02-13-05 05:58 AM Link | Quote
That didn't seem to make a difference... it's working now though.
Originally posted by neotransotaku
I believe you have to change the default class's font to effect the command results...
But I don't want all unformatted files to look like that.

Now this I just don't get.
rewind(file);
fseek(file,SEEK_SET,0x12);
fread(&ImgWidth,4,4,file); //Get width
fseek(file,SEEK_SET,0x16);
fread(&ImgHeight,4,4,file); //Get height

Somehow, the first fseek() ends up at byte 0 and the second at 0x10. Even stranger is without the rewind(), the first one ends up at byte 2 but the second one at 0x16 like it should.


(edited by HyperHacker on 02-13-05 04:24 AM)
Parasyte

Bullet Bill
Level: 35

Posts: 294/514
EXP: 267348
For next: 12588

Since: 05-25-04

Since last post: 104 days
Last activity: 32 days
Posted on 02-13-05 09:48 AM Link | Quote
The origin is the 3rd argument, not the 2nd. And rewind() is not needed before fseek(). Also, you do not have to seek 4 bytes ahead after reading 4 bytes. The file pointer is always automatically incremented after a read. Finally, there are better ways to read integers.

fseek(file,0x12,SEEK_SET);
ImgWidth = getw(file); //Get width
ImgHeight = getw(file); //Get height


One note of caution: getw() (on x86-based machines) will read integers as little endian, so they are effectively byte swapped. If you don't actually want that (which is NOT the case when working with bitmaps, as you seem to be doing) you should use the following, instead (note how the args differ from yours):

fread(&ImgWidth,4,1,file); //Get width
fread(&ImgHeight,4,1,file); //Get height
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 3240/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 02-13-05 11:44 PM Link | Quote
I know I read somewhere that origin was #2, and that did work in another program since I was reading byte 0 anyway. As for the rewind() I was just hoping that would fix it.

A small menu-related problem: Using TrackPopupMenu (with the TPM_RETURNCMD and TPM_RIGHTBUTTON flags), sub-menus won't appear until the option is clicked on. Do I need to do that manually or something like that?
Parasyte

Bullet Bill
Level: 35

Posts: 296/514
EXP: 267348
For next: 12588

Since: 05-25-04

Since last post: 104 days
Last activity: 32 days
Posted on 02-14-05 12:04 AM Link | Quote
Am I correct in assuming that you want a menu to pop up when you right click anywhere in the window? If that is the case, this is what you need to do:

1) Call CreatePopupMenu() or GetSubMenu() to create a global handle to a menu. This should be done in your window initialization message handler (WM_CREATE or WM_INITDIALOG).
2) Call TrackPopupMenu() in your window's right click handler (WM_RBUTTONDOWN). The TPM_RIGHTBUTTON flag in TrackPopupMenu() is used to allow menu items to be clicked on (selected) using the right mouse button. It does not cause the menu to opened.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 3245/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 02-14-05 12:10 AM Link | Quote
That's basically the idea, although the window is actually one big button, so either button opens the menu. I threw in TPM_RIGHTBUTTON because I tend to find myself right-clicking it, so I figured why not? Otherwise, that's exactly how I did it.

[edit] Er, just to clarify... The window isn't actually a button, just a normal popup window. It just looks like a button.


(edited by HyperHacker on 02-14-05 01:30 PM)
Pages: 1 2Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Programming - 64-bit integers in C? | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.009 seconds.