|
|
I am using C++ compiler and linker from VC++ 2003
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Microsoft (R) Incremental Linker Version 7.10.3077
Application is created for Win32. When I link all my objects into executable, I recieve message "Creating library MyProject.lib and object MyProject.exp" and two additional files. What are this files? Why linker create them? How to tell compiler/linker to forget about them?
|
|
|
|
|
I think these files are only created when you make a DLL. The lib file is an Import Library file which lists all the functions whice are exported by the DLL, and is useful when you want to link this DLL to some host exe at compile time, rather than at run time. The exp file is a compiler temporary, and contains the export table to be combined by the linker to make the final DLL. There must somthing funny going on though, because these files should only be created when you're making a DLL!
Joel Holdsworth
"Outlook not so good"
That magic 8-ball knows everything! I'll ask about Exchange Server next
|
|
|
|
|
Yes, that files are created even if you link into executable. The funny thing is: if you use plain C for all modules - that files wont appear. But as soon as you add at least one C++ object into Link list: you will have that files.
cl -c module1.c
cl -c module2.cpp
link /out:test.exe module1.obj module2.obj
and there they are
|
|
|
|
|
I've imported code from Idepemdent JPEG Group to convert jpeg to grayscale. What I need is to convert to monochrome; either jpeg of grayscale. Does anyone know of an article or group that could help.
Thanks
|
|
|
|
|
Simply BitBlt() it onto a monochrome (1 bit per pixel) bitmap.
HBITMAP MakeMonochrome(const HBITMAP &Colour)
{
HDC hDC1 = CreateCompatibleDC(NULL);
HDC hDC2 = CreateCompatibleDC(NULL);
BITMAP bm;
GetObject(Colour, sizeof(BITMAP), &bm);
HBITMAP Mono = CreateCompatibleBitmap(hDC2, bm.bmWidth, bm.bmHeight);
HBITMAP Old1 = (HBITMAP)SelectObject(hDC1, Colour);
HBITMAP Old2 = (HBITMAP)SelectObject(hDC2, Mono);
BitBlt(hDC2, 0, 0, bm.bmWidth, bm.bmHeight, hDC1, 0, 0, SRCCOPY);
SelectObject(hDC2, Old2);
SelectObject(hDC1, Old1);
return Mono;
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Sorry, please excuse my ignorance. I need to do this from a non-windows enviroment which means I have to do all of the grunt work. I know this is a windows group but if somone could refer another group that might help, I would appreciate it.
Thanks again
|
|
|
|
|
OK, then just take your grayscale algorithm and instead of converting each colour pixel into one of the 256 greyscale colours convert each pixel into the two monochrome colours.
psuedo code
grey = (blue * 11 + green * 59 + red * 30) / 100;
pixel = (grey > 127) ? white : black;
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Thanks for the pseudo code. It will take some time to try. If not too lengthy of an explanation, how did you come up with the grey=... formula?
|
|
|
|
|
|
|
Hi,
I have a dialog-based application.
I have 2 2D arrays which wil be used by 2 different dialogs. Creating the arrays involves reading from a file. What I would like to do is to create the arrays as soon as my application starts so that they are readily available when they are needed by the other dialogs.
What is the best way to do this?
What I had thought of doing was letting each dialog have it's own member variables to hold the arrays. I would call a function to initialise them whenever the dialog is made modal.
Or should I have them as global variables?
Which of these is the better way of doing it? Or is there a different way of doing it?
Thanks very much,
dlarkin77
|
|
|
|
|
dlarkin77 wrote:
What I would like to do is to create the arrays as soon as my application starts so that they are readily available when they are needed by the other dialogs.
What is the best way to do this?
You can either make the arrays members of the CWinApp class, or make them static members of a CDialog -based class of which your other two dialogs are derived from.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I was given a data file to read which is in binary format. I was told that the data starts in the file at position 0x1000. Each value following the offset is a 2byte short value. I tried reading in the file using fstream.ReadInt16(). It looks like some of the data is matching up correctly but the other isn't. Below on the left is what the data should be and on the right is what i'm getting
2 2
68 -188
-22 234
18 18
85 85
130 386
454 710
626 114
82 82
127 639
617 617
558 -210
As you can see some of it is matching up. Does anyone know what i'm doing wrong??
|
|
|
|
|
What is the content of the binary file for these numbers. Since the translation is out by either 0, 256, 512 or 768 in all cases it would suggest the binary format is not what you expect it.
Windows expects LSB then MSB. It suggests that the binary file is MSB then LSB.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
The data is suppose to be x and y coordinates, so +/- integer values. I wasn't given any more information besides that. Is this a text encoding problem? Do you have any suggestions on how to test the LSB and MSB problem, I'm not very familiar with this or with binary file reading in general.
thanks for the response
|
|
|
|
|
You may want to read up on Big Endian and Little Endian byte order for number representation.
Intel Processors are Little Endian (PCs) Motorola Processors are Big Endian. Depending on how the file was created and on what operating system it could be stored either way.
Little Endian is LSB then MSB. Big Endian is MSB then LSB.
e.g. The hex value 0x7FFF when stored in:
Little Endian = FF 7F
Big Endian = 7F FF
within the file.
Note: Network packets have numbers stored in Big Endian no matter what OS originated them.
I would suggest reading the raw data into a buffer then looking at the buffer contents (2-bytes at a time). You may be able to analyse why the numbers are not showing as you expect.
Note: For a signed short(2-byte integer) the positive values will be 0x0000..0x7FFF and the negative values are 0x8000..0xFFFF.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
It looks, like after you read two bytes into buffer, you put a garbage in high byte, low byte is always correct:
68=0x0044, -188=0xff44
-22=0xffea, 234=0x00ea
130=0x0082, 386=0x0182
... etc
You have a bug somether in your program. Either two varables share the same memory, or you read just one byte and forget another, or....
|
|
|
|
|
hi people i am a college student at the moment currently trying to figure out c and it aint happenin. I need help with 2 things: -
1.i need code for a decimal to hexadecimal converter without using things such as printf etc in the function
2. i need code for a program to convert strings of text all to uppercase again without using printf etc in the function.
any help will be greatly appreciated and will help me not fail me course.
|
|
|
|
|
I have good news and bad news. The good news is - there is google and many, many tutorials out there. The bad news - if this is giving you trouble, it's going to get worse. You need to plug away and do your homework....
C. Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
|
|
|
|
|
Bobsyourmother wrote:
1.i need code for a decimal to hexadecimal converter without using things such as printf etc in the function
Even if you were allowed to use printf() , it would not help in the conversion of base-10 to base-16. While it's true that printf("%#x", 45) would display 0x2d, the number was not actually converted, it was just displayed in a different base.
Counting in different bases is really easy once you know what's going on. The reason that we count in base-10 is because of the number of digits we have on our hands. Were we born with eight digits, our numbering system would be in base-8 instead. That said, the number 2468 in base 10 is:
2x103 + 4x102 + 6x101 + 8x100
In base-8, it would be 4644 or:
4x83 + 6x82 + 4x81 + 4x80
People often think that a computer is this mystical device that somehow manages to do something that people cannot. Wishful thinking but it does the same thing that a person can do only faster and more efficient (e.g., a faster computer doesn't fix bugs, it only makes them faster!). If you cannot do it with pencil and paper, the computer can't do it either! That said, you need to figure out how to do the conversion on paper and then converting that to code will be much easier.
Bobsyourmother wrote:
2. i need code for a program to convert strings of text all to uppercase again without using printf etc in the function.
The ASCII value of 'a' is 97. The ASCII value of 'A' is 65. That should say to you that each lowercase character would need 32 subtracted from it for the uppercase equivalent.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I wish there was a filter to prevent redundant and do my homework for me questions...
These I find are more annoying that advertisements in article forums...
Ahhhh man....
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
I agree but it's a fine line. I've asked a few questions recently which clearly weren't 'real life' scenarios but interview questions I've had and answered. I wanted to know what others think. It's interesting that you get three or for people answering and get three of four different answers. It really is a superb way to learn. I think if you're up front about why you'er asking, then the reader can make the choice whether to answer or not.
Also, to ease my guilt, I do also cut'n'paste the code I've actually tried to get working and not just ask - 'How do I do this?'.
You got to credit this guy with the sheer brassnecked approach. Just hope he has access to CP in his exam (like I wished I had it in my last interview!).
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
In C language:
1. Use sprintf or scanf to store result in string
2. In ASCII table:
small letter: from a=97 dec (0x61) to z=122 dec (0x7a)
big letter: from A=65 dec (0x41) to Z=90 dec (0x5a)
97(a)-32(0x32)=65(A) ... 122(z)-32=90(Z)
|
|
|
|
|
thanx m8 for the help i appreciate all that helped and people who say jus keep tryin dont u think i have this was me last resort come on ive been using c for a month at most and i cant grasp it not me fault and by the way its all assignmemts so no exams thx again helpers i am intedebted
|
|
|
|