C/C++ :: Object File Size Increases In Windows?
Apr 11, 2013
My sample.h is
#include <string>
namespace xxx
{
class abc
[Code]....
My Question is when i compile this code in Linux platform Using g++ compiler My sample.o's Size is 1Kb.. But when the same code is compiled in Windows platform using VC++ Compiler , My sample.o's size is 42Kb..to reduce the size in windows... Is there any proble with '#include <string>' in Windows platform.
View 3 Replies
ADVERTISEMENT
Jul 22, 2012
I've been in a strange problem. Im in need to have a dynamic character size, but that increases the outputsize of my program by almost 50kb. (while the program was 11kb previously).
Example:
Char One[7000]; (11kb output)
int Z = 7000;
Char Two[Z];
View 7 Replies
View Related
Sep 30, 2013
I am using
#include <vector>
#include <map>
In my c++ project, and these 2 header files are included in almost 200 .cpp files and when i build a static library for the whole project in linux its size is around 10MB and when i did the same thing in windows its size is almost over 80MB, and one thing i noticed was both vector and map combinely takes 500KB in each .cpp file in windows. I am building the static library in windows using release mode.
I am using VS 2007. Any way to reduce the library size.
View 2 Replies
View Related
Sep 14, 2014
I just wrote the following simple program:
Code:
#include <stdio.h>
#include <math.h>
int main(void) {
float fx, x;
[Code] ....
The output increases x by 0.1 as expected until x=1.5. After that x becomes 1.600001 and not 1.6 as expected.
View 9 Replies
View Related
Dec 25, 2014
In 32bit, the object header size is always 8bytes.
In 64bit, the object header size is always 16bytes.
Is this safe to assume or are there situations where the header size can be smaller/larger than the numbers above?(Haven't found anything on this, so I assume no?)
I need to know the exact size of the object header, because I need specifically pad a few classes I wrote to avoid false sharing along cache lines. Just need to make sure I have the sizes correct so I don't pad them wrong!
View 3 Replies
View Related
Feb 5, 2014
hiclass Parent {
};
class Child : virtual public Parent {
};
What is the size of object of Class Child in following case?
View 17 Replies
View Related
Feb 10, 2014
I am using Visual C++ to write an app. I write CMyObject class and may allocate a lot of instances of CMyObject object, so I want to reduce the size of CMyObject class.
What I can figure out to do is:
1. I can use the following code to get the accurate size used by a single instance of CMyObject object:
CMyObject Object;
//Get the size of memory allocated for CMyObject object
int nSize = sizeof(Object);
is that correct?
2.To reduce the size of CMyObject, I have several ideas:
(1)Change member function to static member function if it is possible, since each member function will take some spaces in the instance of CMyObject.
(2)Change virtual member function to member function if it is possible, since virtual member function may take more spaces.
(3)Eliminate unnecessary member variables to reduce spaces.
(4)Finally, if (1), (2) and (3) does not work well, then change CMyObject from class to a struct that only contains some member variables, thus will eliminate the spaces allocated for constructor and destructor of a class.
View 2 Replies
View Related
Aug 20, 2013
What is the size of object in c++ , if there is no data member in the class ?
View 3 Replies
View Related
Feb 17, 2015
I am interested in creating a file of a given size and then randomly accessing the file to populate it. Is there a way to quickly create, for instance, a 4 GByte file in C++, initially populated with garbage?
View 4 Replies
View Related
Sep 13, 2012
I need to copy a file from remote location.
I know following information.
a) Address of the remote file location
b) Port number
c) File Name
d) Size of file in bytes
How i copy the file from specified port/socket and write it to the file opened in local machine.
View 3 Replies
View Related
Apr 14, 2014
I am starting a project in a few weeks that needs to be able to prevent an executable from running until it has been checked for various criteria (think of it as a DIY anti virus).
My main idea is to build a file filter driver in C to hook into file system reads and writes and prevent executables that I don't like from executing off the disk.
View 1 Replies
View Related
Feb 7, 2015
I want to load a file to rich text box component. I have this line:
richTextBox1->LoadFile("StudentaiRez.txt", RichTextBoxStreamType->PlainText);
But I get an error when I try to pass second parameter. It says : type name is not allowed.
I probably write it wrong, but I can't remember the correct way. In examples I only see that instead of -> dot is used, but it doesn't work either.
View 1 Replies
View Related
Dec 7, 2014
I need to apply theme file in windows form but I can't. When I use the code below I get error because there is no System.Windows.Application
StreamResourceInfo sri = System.Windows.Application.GetResourceStream(
new Uri("App.xaml", UriKind.Relative));
var resources = (System.Windows.ResourceDictionary)Load(sri.Stream); ;
var app = new System.Windows.Application();
app.Resources.MergedDictionaries.Add(resources);
View 2 Replies
View Related
Sep 27, 2013
I need to be able to actually read my encrypted file..
I have the decryption code and works perfectly when running it through console app c++.
But, the way I decrypt is to decrypt from a file, and create a new file which is decrypted.
I can't use that kind of code in my program in windows form app c++..
I need to read the encrypted text file and decrypt it in memory while using it for my program..
Some links to my codes I use at the moment.
My decryption coded in console application: [URL] ....
My decryption code edited for form application (Did not do anything) [URL] ....
And this is the code I tried to read after it got decrypted (Reading file written in combobox_selectedindexchange: [URL] ....
View 2 Replies
View Related
Apr 25, 2014
Examples: "sql.h" header file how to skip compile in vs 2008 ?
View 2 Replies
View Related
Oct 6, 2013
I've been looking into the file structure of BMP images and everything I'm reading says that the 4 bytes following the signature are designated as the filesize of the bmp file... It's always zero for me regardless of the BMP file. The signature is always correct though.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
[Code]....
View 9 Replies
View Related
Dec 9, 2014
How can i put double click to open the file in treeview
private void button1_Click( object sender, EventArgs e ) {
XmlDataDocument xmldoc = new XmlDataDocument();
XmlNode xmlnode;
[Code] ....
View 2 Replies
View Related
Oct 11, 2014
I have a problem with an extension DLL that has an exported function. The function is being exported ok, it is called by a Windows service. The Windows service is using the exported function, and everything works. I am trying to create a file with:
ofstream file;
file.open("C:dir ofile", ios:ut);
file << "text";
But nothing happnes however. There are no errors, the file is just not created. Also, if i try to call MessageBox() in the exported function, nothing happens as well . I have a .h file which exports the function with __declspec(dllexport) DWORD WINAPI functionName(), and also a .cpp file with the function definition. There is no main().
View 4 Replies
View Related
Nov 27, 2012
Change the frame window size according to font size increases.
View 3 Replies
View Related
Sep 7, 2014
I finally accomplished what I'd asked for earlier.
I'm able to input data from txt file to c++ array.
the Text file contains around 60,000 lines "numbers" to be loaded into a c++ array to calculate some stuff.
I'm able to load 60,000 lines "txt file size 1.1MB" no problem, but sometimes when I try to load more lines "from a file around 1.4MB", the process terminates and gives me an error message "n.exe has stopped working, Windows is checking a solution to this problem" and Code::Block shows error "Process terminated with status -1073741819 "
View 2 Replies
View Related
Feb 1, 2013
I must take an old MFC project in VC++ 6.0 and make changes.
The problem is text size in screen is different from size in print preview.
for example with this font
Code:
CFont f50;
f50.CreateFont(100,0,0,0,FW_BOLD,0,0,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,"Frutiger LT Std 45 Light");
And this text
Code:
s=_T("Let's try to calculate the size of this text");
and with MM_LOMETRIC map mode
GetTextExtent() returns me:
On screen: (1595,99)
Ink printer + print preview: (1589,100)
PDFCreator + print preview: (1580,100)
comparing with screen size the height is bigger but lenght is smaller. I don't understand.
I can understand that different printers process the fonts in different way and then to have different lenghts. That's not the problem. The problem is I need to simulate in screen the same behaviour i will have on printer because these texts are being aligned in the document, and I don't want to see that the text si aligned different in text than in paper.
What can I do to render the text on screen with the same size I will have on the printer? Print preview is doing it. Should I change the font parameters? is something related with pixels per inch?
View 4 Replies
View Related
Nov 29, 2013
I was wonder if I can make 2 different size structures in a file. I wrote a code but It's apart of my school project and I havent compiled it yet, so Im just wondering will this work?
Code:
if((stsPtr = fopen("status.dat", "rb")) == NULL){
prinft("File could not be created/opened.
");
Error();
[Code] .....
View 1 Replies
View Related
Jan 2, 2013
I am trying to create an array with the size of the first value of one file wich is the same of the first line because the first line only have one value. Here is how i am trying to do it ...
FILE * fich;
int test;
fich=fopen(nome_ficheiro,"r");
fscanf_s(fich,"%d",&test);
int np=test;
No*aux=primeiro;
[Code] .....
View 3 Replies
View Related
Jan 13, 2015
I have been given a task of checking the size of file in Linux machine using C Program. Below is what I came up with
Code:
#include <stdio.h>
void main(int argc, char **argv) {
FILE *fp;
char ch;
int size = 0;
[Code] .....
But Now I have been asked to modify this code in a way that instead of passing the file name as parameter, I have to make a database connection and fetch the value of the filename and location from the database table and check the size . My program has to repeat this process every ten minutes, which means every ten minutes my program has to hit the database, fetch the value and check the size in the file system.
I heard like I Have to create a Fork Call, and have the child instance run every ten minutes.
View 6 Replies
View Related
Oct 22, 2013
I'm doing a Text-based RPG game and it will include some checkpoints, on those checkpoints the game will save the progress, so I need to write all my variables to a text file and then read them all when the player loads the game.
Some of my variables, like enemyNames, dont have any determined size, they're like this: "int enemyNames[];"
So how do I write an array to a text file without determining a size?
And how do I read them when the player loads the game?
View 5 Replies
View Related
Feb 24, 2012
Where i can get ready function, which return string, which describe size of file?
For example
4 = 4 b
1045 = 1,01 Kb
and etc.
View 3 Replies
View Related