Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Depending on the operating system, argv[0] may contain the full path to the program. It does that when run under MS-Windows, but may not when run under other operating systems.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Browse around MinGW.org -- the Windows port of the GNU compiler. If you also want a nice IDE then download Code::Blocks, which also supplies MinGW compiler tools.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The return type is the same type as what the function returns. Those that return nothing are declared void function(); . If the function returns an integer then declare it as int function(); That shouldn't be all that hard to figure out -- just look at the return statement in the function.

lines 5-10 are in the correct place, all you have to do is add the return type to those function prototypes.

lines 13 and 14: that is calling function menu() twice. Delete the function call on line 13 and make line 14 look like the function call that's on line 13.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

which function do you mean? If you mean lines 6-10 then the those functions must be declared to return something, such as int function() or void something() . Default return values are not permitted in c++.

line 153: that should be () at the end because its calling a function. However, that aside, the line is making a recursive call because its calling itself, and that will crash your program because there is nothing in that function to stop the recursion.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Where can I download it?
Where can you download what?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The operating system populates argv[0] -- you don't have to do anything. When you type an argument on the command line it becomes argv[1], not argv[0].

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
  1. Don't clear the screen because there may be information on the screen that people want to see. But you could use something like system("cls") or write your own cls() function using os api calls.
  2. namespace is just an umbrella used to keep symbol names from colliding with each other. It just groups together names/classes/structures/objects.
  3. getch() has nothing to do with the how to declare main(). main should never be declared as void because it always returns an integer whether you tell it to or not. Even if you omit the return statement main() will return an integer anyhow.
  4. Yes -- the syntax for a structure has never changed from day one when K&R was written.
  5. c++ does not require an explicit return statement -- main() defaults to 0 if you don't tell it to return something else.
  6. You can use them all except iostream.h, iomanip.h -- all you have to do is omit the extension on those two leaving <iostream> and <iomanip>.
  7. Put a 'c' in front of those names, such as <cmath> and <cctype>. The only difference is the compiler will put them under std namespace.
Salem commented: Nice +18
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't use a mac but I know that wc file1 file2 works on *nix and MS-Windows. When you say "it doesn't work" what exactly do you mean. More than likely the problem is your program, not the os.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That's a famous behavior of MFCs Close button -- the Close button is activated when the Enter key is pressed. One way to fix that is to catch the WM_CLOSE event and ignore it, but then you might not be able to close the program at all.

Another way is to catch the return key in OnTranslateMessage(). This is for CDialog, but you can do the same thing in any type of MFC program.

BOOL CTestmfcDlg::PreTranslateMessage(MSG* pMsg) 
{
	if( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN )
	{
		return FALSE;
	}
	return CDialog::PreTranslateMessage(pMsg);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

1) name is an uninitialized pointer. You have to allocate memory for it before it can be used as an input string (line 14). Just declare name as a character array instead of a pointer, such as char name[80]; line 11: There is no reason to make that variable a pointer since all you want is 10 floats. Just declare it as an array float array[10]; line 12: You can just delete this line if you make that variable an array of floats as above. In c++ programs you should use the new operator instead of malloc() or calloc().

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Read through Microsoft's Scribble Tutorial -- it is something similar to MS-Paint and it serializes the data. See how that tutorial serializes data and it might give you some ideas how to implement it in your program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

don't run the installer, copy the installed folder. who runs the installer of a 16bit compiler?

I don't have an install folder, just a bunch of *.zip and *.cab files. Attached is a list of the files

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If that turboC compiler is working for you ok with xp than don't upgrade to Windows 7. There is supposed to be an XP compatability mode but it is not in the Home Prem version that I have (at least not that I know of). I also have 64-bit version of Windows 7 and the error message I got when I tried to install TurboC was that the installer was not compatible with 64-bit Win7.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sorry, but I can not help you because TurboC can not be installed on Windows 7 os (I just tried it).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>but it's not working
What exactly does that mean? Did you get compile error messages? Yes, then post a few of them

>>int gdriver=DETECT,gmode;
That looks very questionable -- why use the comma operator ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

dude i knw hw to speak/explain in english...
n also the prblm m facing...
may b u r not undersatanding

obvsly nt sc y cnt wr a dcnt sntce.

jonsca commented: Nice +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

m not getting hw to compile it using notepad++

i know tis not a compiler...
n m asking to tell me how to make notepad++ to compile c++ program

No one can help you if you yourself don't know what you want. Maybe you are just having problems trying to explain it in English language??

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

these programs can b compiled using notepad++..theres no need to chage lappy...
jst that m not getting hw to compile it using notepad++

As others have tried to tell you -- Notepad++ is not a compiler. I think you can tell notepad++ how to run a a compiler, but notepad++ doesn't compile anything itself.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

zip up your entire project and attach it to your post. Delete the compiler-generated files, especially those precompiled header files.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you need to include windows.h, not ole32.h. Here are the changes you need to make to stdafx.h. Notice I deleted the line I suggested previously because windows.h forces all the necessary libraries.

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

// TODO: reference additional headers your program requires here
#include "windows.h"
#include <stdio.h>
#include <iostream>
#include <tchar.h>
#include "bridge.h"
using namespace std;
Nick Evan commented: Nice one :) +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Post code so that I can try it out.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Agni commented: Nice article..!!! +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

menu Project --> Properties (bottom item of the popup menu) -->expand the Configuration Properties tab --> Linker --> Input. The first line on the right side is "Additional Dependencies". Add the name of the library there.

An alternate way to do it is to add this near the top of one of the *.cpp files in your project #pragma comment(lib, "ole32.lib")

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what version of the compiler IDE are you using?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your program needs to link with Ole32.lib. Check the project setting of your compiler to see that it is doing that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Shall I repeat myself -- use GetModuleFileName() -- this will return the full path where the program that is currently running was started. If you are trying to get the path of another program then this will not help you.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This Q&Awill help you (first one at the top of the page)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Create a new project then add the existing *.c or *.cpp file(s) to it. See if that new project compiles ok.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Try deleting all the compiler-generated files from your project directory and the exe too, then recompile. Also check if there is another instance already running of the program you are trying to compile. Do this by looking at Task Manager.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>A better solution might be to create a buffer (just an array of bytes), fill the buffer then write the buffer

But that won't work for huge files.

Here is another solution

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you are using MS-Windows then you could call win32 api function CopyFile() to copy the file then delete the original. Otherwise, just write your own copy function to copy the file.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have to set the focus to edit1 before calling SetSel()

CEdit* pEdit = ((CEdit*)GetDlgItem(IDC_EDIT1));
pEdit->SetFocus();
pEdit->SetSel(0, -1); // select everything
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I searched but couldn't find any threads on the topic..

why would Dani want to create a forum for something that will not be used ???

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I suppose first you will have to figure out how to translate the numerical format in edit box #1 into the format contained in edit box #2. I have no idea how you would do that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Probably
1) get the text from box1 into a string object
2) get the text from box2 into another string object
3) search text from box2 to see if it contains the text in box1
4) if found, highlight the text in box2

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That is correct, because static class functions are just like any other global function except for the class scope identifier.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Just as I suspected. Only static methods can be passed to that C function. Make the function error static and it will probably compile ok.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

post code of the class and the method that is causing the problem.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

An example you can see here occasionally a = c++ + ++c; The result of that expression is undefined because (most likely) it violates the rules you cited. Consequently the result store in a will be whatever the compiler writer decided it to be.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ctrl+Z is not the same as EOF.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think the solution to your problem is found in this thread.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Pass it as in the second example: void func2(tc_struct** ptr2) Its not necessary to add more stars and pointers to pointers to pointers ...

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It's baaack :) Thank you Dani :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can write files anywhere you want to on your computer as long as your login account has permissions to do that. For example newfile.open("c:\\dvlp\\test\\exemplu.txt");

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>So what really decides the size of an exe file.
Your compiler. Two different compilers using the same identical code can produce different exe sizes. And the same compiler can produce different exe sizes depending on the flags you give it, such as DEBUG and UNICODE, and the way it might optimize or not optimize the code.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I downloaded, installed and created a test console program. Interesting looking C compiler (it is not a c++ compiler too).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

See CEdit's SetSel method

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You are suggesting a blackball list? Or a hit list? Just because someone doesn't mark the thread solved, reply, or post a thank-you doesn't mean your post was not helpful or unread. Of all the 10 thousand threads I have posted in only 1500 of them were marked solved, or roughly 15%. Are you saying the other 85% should be on my hit list?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The structure isn't correct, you don't have to specify the number of digits in the integers. A single integer can hold lots of digits (see limits.h in your compiler's header files).

typedef struct
	{
	int site_id_num; /* id number of the site */
	int wind_speed; /* the wind speed in knots */
	int day_of_month; /* the day of the month written as dd */
	int temperature; /* temp in celcius */
	}measured_data_t;

lines 20 and 21: It isn't necessary, nor even desireable, to put those on two different lines -- just declare the function all on one line int main() lines 36-39: you need to make those parameters pointers if you make the changes I suggested to that structure. e.g. & measuredp->site_id_num You also need to make that a loop so that it will read in all the rows in the file. Then store the data in an array of structures.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If your target os supports standard iostreams then I'd use it. win32 api is very low level and supports only binary files -- yes text files can be written as binary files but using std::fstream makes it a lot easier.