|
Things to look into:
1. Precompiled headers.
2. Unneeded include files.
3. Using abstract base classes as interfaces to avoid having to include class definitions.
Steve
|
|
|
|
|
Stephen Hewitt wrote: 3. Using abstract base classes as interfaces to avoid having to include class definitions.
Yeah this is what i want to hear. I was never sure. Currently my design lacks abstraction. But now - implementing and converting candidate classes will mean a huge design change.
Thanks!
|
|
|
|
|
ok very simple: i am trying to read a line of text from a text file.
here is the text file:
dg_bead<br />
-15<br />
5<br />
5<br />
1<br />
0
here is the code that reads in the first line:
ifstream dg_scenario::dg_replay("replay.txt",ios::in);<br />
char tool_name[256];<br />
dg_replay.getline(tool_name,256);
i put a break point in this line:
dg_replay.getline(tool_name,256);
the app triggered the breakpoint and i stepped through it.
then i checked the value of tool_name and it was:
0x0222a978 ""
i checked all the indices of the array and they were all zero!
this is a very simple task - how should i resolve it.
P.S. i need to use the tool_name[256] char array as a char* to pass it as a parameter through a function that only accepts char*. is there a way i can convert the value stored in tool_name[256] (once the above prob is fixed) into a char* that stores the same value.
thx in advance.
--
dg
|
|
|
|
|
What happens if you try this?
ifstream dg_scenario::dg_replay("replay.txt",ios::in);
char tool_name[256];
if (dg_replay.is_open())
dg_replay.getline(tool_name,256);
or
ifstream dg_scenario::dg_replay("replay.txt",ios::in);
char tool_name[256];
if (dg_replay.good())
dg_replay.getline(tool_name,256);
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
nice to see you're helping kiddies cheat on their homework
|
|
|
|
|
I'm gullible like that!
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
genius - it works.
thanks!
--
dg
|
|
|
|
|
moonraker928 wrote: genius - it works.
I don't know why - I only added a line to check if the file was opened successfully
Glad it works!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
Is this a homework assignment? did the prof say you need to use tool_name limited to only 256 chars ... shame on you, I will not be a part of this!!!
|
|
|
|
|
|
hi all.
my app is throwing an unhandled exception - the problem appears to be caused when istream adds a null character at the end of a char array when the getline function is called
here is the code:
i initialized the tool_name in this line:
simpleTask.cpp
char* tool_name = "";
i put a breakpoint here:
simpleTask.cpp
dg_replay.getline(tool_name,256);
when i ran the app, the breakpoint was triggered. i stepped in and it brought me to this line:
istream.cpp
*_Str = _Elem(); // add terminating null character
at this time, an unhandled exception is thrown.
--
dg
|
|
|
|
|
I'm surprised it made it that far
char* tool_name = "";
defines and initializes a pointer to a constant array of characters 1 byte long (the NULL
terminator).
This should work better:
char tool_name[256] = "";
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
who names their file " simpleTask.cpp" and can't get it too work...LOL dude I told you already stop cheating on your homework assignment or I am going to tell!!!;P
|
|
|
|
|
hello friends
how can i read data from tablet connecting to my computer through usb interface
if one have a program doing this or any advise please send it ot me
i like to use visual c++ 6
|
|
|
|
|
1) Where can I obtain Microsoft Developer Network CD?
2) What are the other ways to know advanced windows concepts except for books written by Mark/David and Jeffry Richter
|
|
|
|
|
tom groezer wrote: 1) Where can I obtain Microsoft Developer Network CD?
From Microsoft.
tom groezer wrote: 2) What are the other ways to know advanced windows concepts except for books written by Mark/David and Jeffry Richter
Google for them. Read through CP articles. Ask questions.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
In terms of any other books
|
|
|
|
|
>>1) Where can I obtain Microsoft Developer Network CD?
I believe you would have to subscribe to MSDN for that? An alternative is to download the platform SDK, it comes with help files on the Win32 APIs that's pretty much all you need. You still have the MSDN website, much slower but you still get what you need.
>>2) What are the other ways to know advanced windows concepts except for books written by Mark/David and Jeffry Richter
Learning comes from reading and then applying, not sure if there are any short-cuts but if you find one let me know!
Books are your best best they will assemble all the bits and pieces for you, otherwise you will waste your time searching for on the net, plus you will get a fragmented view of things and be on here asking lots of questions
GL on your project!!!
|
|
|
|
|
See www.codeguru.com and www.codeproject.com about your section question.
|
|
|
|
|
- Is it possible to program using both
OpenGL api and Direct3D api, or is
this a big no-no?
- And, Yes I am crazy;P
"Shorter of breath,
and one day closer to death"
~Pink Floyd
|
|
|
|
|
Do you mean DirectX?
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
- What i am actually trying to do is make
some modifications to the Blender source code
to fix my problems with the buttons and menus being
drawn incorrectly because of driver issues,
but all can be fixed if just the ui goes DX.
PS: The actual 3D window is fine i just want to mix the OpenGL editing with the buttons and menus being drawn with DX
-- modified at 16:38 Thursday 19th July, 2007
Come on guys. I just need to know if it wont crash my computer with the mix of the two.
-- modified at 16:39 Thursday 19th July, 2007
"Shorter of breath,
and one day closer to death"
~Pink Floyd
|
|
|
|
|
Hi, I am using Visual C++ 6.0 MFC and I have an application where I have a window that allows me to set up some criteria and then click on a print button. The Microsoft Print Dialog appears and I can change the number of copies to something other than 1 but I will only get 1 copy. I thought the number of copies behavior was determined by the Print Dialog box. Do I need to set somthing up to enable multiple copies?
Buck
Buck
|
|
|
|
|
I wanted to create a number of Visual Studio projects with the same settings and add various files to them. They're going to be native C++ Win32 projects. Unfortunately I don't see how to do this...
http://msdn2.microsoft.com/en-us/library/ms228767(VS.80).aspx includes details on how to do this for C# and VB.NET projects but not VC++ (although I don't really understand the OnConnection method in the examples). As I understand it VC++ uses a different project template structure from those two languages. I couldn't find any more details beyond that though. I dug around in the Visual Studio directory for awhile looking for analogous files for C++ project templates but couldn't find anything but wizards (not the zips and other files I need). It seems like if I could just get past the hurdle of creating the project files I could get this working.
Does anyone know if this is even possible? I was going to just create my own template type so I could easily find the directory and files but then I found out VC++ doesn't even support the 'Export template...' option in the file menu.
|
|
|
|
|
I'm not sure I don't really use VS much (I find it much slower than other C/C++ compilers )
If you can't do it from VS, you could write an application to do this.. You could just have a basic dialog box with some settings in it, and then a number of template project files (just ordinary .txt files or something) which are copied to the chosen directory when all of the settings have been set.. This method would also allow for more flexibility..
Hope this helps!
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|