15,300 Posted Topics
Re: It will not work with Turbo C because that compiler can not call any of the ms-windows library functions. As for borland, it depends on which version you are using. If its a 16-bit version like Turbo C, then that compiler will not work either. | |
Re: You didn't tell us the name of the structure or its contents, but basically something like this: [code] struct something { // blabla }; void foo( struct something& n) { } int main() { struct something s; foo( s ); } [/code] | |
Re: Use a different IDE such as Code::Blocks or VC++ 2008 Express that generates the correct code for a windows application. MS-Windows applications are not supposed to have that console window in the background. | |
Re: you might want to get a copy of [URL="http://en.wikipedia.org/wiki/Edlin"]edlin line editor[/URL] and see how it worked. | |
Re: At least two problems with your program. [list=1] [*]The space is not the only character that is considered white space. It also consists of tabs, back spaces, and returns '\n'. The safest way to check for all these is to use the macro isspace(). [*]You can not use fstream's >> … | |
Re: Do you have an MFC program? Try CWnd::SetIcon() method. Not sure it will do what you want, but you can try it. | |
Re: Make sure you set the tab order of the objects in the order they should appear on the screen. If you use the IDE's resource editor to create the dialog box and its objects then its pretty easy to change the tab order.You might have to experiment a little with … | |
Re: >>int __cdecl main(void) Remove __cdecl because it isn't needed. The compiler will generate the correct code without it. The c and c++ standards do not allow other kinds of function declarations. Don't know the answer to your question. Are you trying to compile that code as a C++/CLR project? If … | |
Re: Did you use g++ as the compiler on *nix with NetBeans IDE? If you did, then MinGW is the MS-Windows port of that *nix compiler. Even so, your program may need some tweaking in order to get it to compile with MinGW. What windowing GUI engine did you use in … | |
Re: Dani needs to replace her picture on that link -- its terrible. | |
Re: you mean something like this: [code] const char* gettime() { static char curtime[20]; time_t now = time(0); struct tm* tm = localtime(&now); sprintf(curtime,"%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); return curtime; } [/code] | |
Re: what version of vs are you using? I tried to compile that *.cpp file using VC++ 2008 Express and get lots of errors. There have been lots of changes between vc++ 6.0 and 2008, so you might want to compile it with 2008. Also, please post randomc.h | |
Re: next you need to put all that code inside an infinite loop so that it will get repeated until someone selects the 5th menu item. Then after printing the menu you need to get user input by calling cin.get(). You also need to write four functions, one function for each … | |
Re: Probably not. Just create a new project in builder then add the files from vs into it. I have not used builder for quite a few years to I don't know the current compiler. | |
Re: >>Thus, if the user selects (4) from the menu once, then again selects (4), the information will be printed twice the second time. The reason is that the linked list is not destroyed between calls to menu item (4). Thus, when that function is called again it simply appends all … | |
Re: [URL="http://www.codeproject.com/info/search.aspx?artkw=usb+drive"]Some suggestions here[/URL] | |
Re: >>line 38: return main(); Never ever under no circumstances should you make recursive calls to main(). That function is to be called only by the operating system during the program's initial startup. When you want to repeat something, like that menu, use a do or while loop. | |
Re: No. But you could open a socket to another computer and ask it what time it is. [URL="http://en.wikipedia.org/wiki/Network_Time_Protocol"]Read this link[/URL] | |
Re: >>Can anyone help? Probably. But you are just wasting everyone's time if you don't post the code you have tried. We are not mind readers. | |
Re: since the result of line 12 sets variable compare to either true or false, then I would think you would want the result of line 8 to be similar, e.g. [icode]compare = stricmp(this.item, item) < 0;[/icode] | |
Re: Do you mean std::string? Yes, then use its find() method. If you mean character array then use standrd C function strstr() which is declared in string.h (or cstring for c++ programs) Of course you may not be allowed to use either of those if your instructor wants you to write … | |
Re: first off, function create() is generating nodes that are never used. Let main() pass a pointer to the head of the linked list and let create() malloc it. [code] void create( node** head) { node* newnode = malloc(sizeof(node)); newnode->next = NULL; if(*head == NULL) *head = node; else { // … | |
Re: Depends. Does your application have a File-->Save and File-->Open menus? Then put that code in the event handlers for those two functions. Otherwise you could put the read code in OnNewDocument() and the save code when the application exists. | |
Re: [QUOTE=sid78669;1156080]I am using char * for getting data from the user. Now, if i just do [CODE=C++] char * data = new char[100]; cin >> data; [/CODE] The data is corrupted, i.e. only data before whitespace is stored; and the following is an example result: [CODE] enter: "Microsoft Co." data: … | |
Re: >>Is this a 64 bit issue? Im on a x64 project.. Not if you are compiling with a 32-bit compiler. It's the compiler, not the os, that determines 32 or 64-bit programs. But I doubt that is the case. Post some code that demonstrates the problem. | |
Re: >>what program will use with to problems.... That doesn't make a lick of sense. I hope English is a second language for you. If English is your mother tongue then you need to go back to grade school and learn how to write a proper sentence. | |
Re: move lines 34 and 40 up near he top of main() so that the rest of your program can access those two stream objects. The two open statements are correct. line 33: wrong comparison. If the user must enter either 1 or 2 then line 33 comparison should be [icode]if( … | |
Re: lines 5 and 7 are do-nothing lines. The don't do a damned thing. You could delete both lines and the loop would work the same way. >>//resets command to null Says who??? | |
Re: [b]>>I am getting stuck in an infinite loop when I input a character instead of an integer during a scanf("%d"....);[/b] That's why I always (or normally) use fgets() instead of scanf(), then after validating input convert the text to an int. C language does not provide a standard way to … | |
Re: >>I have worked on this program and cannot figure out what keeps happening. You will need to explain the problem in more detail if you expect any help. What is the program doing that it is not supposed to do? Is there a reason for the { on line 40? | |
Re: No idea why it doesn't work. What does it do that it is not supposed to do? Or what doesn't it do that it should? | |
Re: why are you opening the same file twice (lines 11 and 22) ? fseek() does not work well with text files. | |
Re: >>Hi, i am doing my mom's c++ for engineering class,and doing a project for her, So you are helping your mom cheat??? Bad idea. Does she do your homework for you? (Probably not). How do you expect her to lean anything if you do her work for her. or do … | |
Re: [URL="http://lmgtfy.com/?q=c%2B%2B+piping+tutorials"]link this one?[/URL] | |
Re: [QUOTE=tetron;1154584] I found that visual studio has ~2Gb limit as an application. [/QUOTE] That is the limit of all 32-bit compilers, not just visual studio. Install a 64-bit compiler (vs express doesn't support it, so you will have to buy it) on a 64-bit os and the limit will be … | |
Re: Why is that a recursive function ??? A simple loop with the mod operator % (to find out whether the number is even or odd) will do the trick. No point in overcomplicating that function unless recursion is required by your teacher. | |
Re: >>void arrays::Talk(hold&, keep&) { from line 5. You need to add the data type of each of those parameters, such as [icode]void arrays::Talk(string &hold,int &keep) {[/icode] >>a.Talk(feelings&, array_size&); Remove the two & symbols. | |
Re: line 20: Whether that line succeeds in connecting to your printer will depend on the printer and operating system. I have an HP Officejet laser printer on USB (Windows 7) and that line failes to open it. line 24: you are sending a binary number to the printer. Printers do … | |
Re: >> if (temp == c[i]) Your compiler is correct. Variable [b]c[/b] is a single character, not a character array. Maybe you mean [icode] if (temp[i] == c)[/icode] | |
Re: You will have to write your own functions to add and subtract strings because those numbers are too big for normal integers. The solution in Turbo C will be no different than for any other C compiler. And don't ask me to do your homework without depositing a very very … | |
Re: You mean after you re-start the program? The way to do that is to make the program open the file and read the value of the variable(s) that was written. If the file does not exist then the program should do nothing. | |
Re: DWORD is not a standard C or C++ data type -- it is defined in windows.h. But if you want to use it without windows.h then you will have to declare it yourself as anything you want. For consistancy you might want to declare it as [icode]typedef unsigned long DWORD;[/icode]. … | |
Re: Without being more specific as to what you want, [URL="http://www.cplusplus.com/reference/clibrary/cstdio/fscanf/"]just read this[/URL]. It will tell you everything you need to know about that function. | |
Re: why don't you just use sprintf()? With sprintf() you can do all that in one line of code. Do not put spaces in the date string because many programs have problems with the spaces, and arrange the string so that the file names can be easily sorted using Windows Explorer … | |
Re: Don't worry about duplication because arrays are always passed by reference never by value. The & operator is unnecessary and sometimes may pass the wrong thing. The way you posted is correct. I would be more concerned about the 72,000,000 bytes (about 70 meg) of memory that the array will … | |
Re: [URL="http://letmegooglethatforyou.com/?q=Customer+List+Extraction"]Here you go[/URL] | |
Re: Think of a 2 dimensional array like a checkers board, which has rows and columns of squares. Or you could think in terms of an electronic spreadsheet. In a 2d array the first dimension represents the rows and the second dimension represents the columns. You might declare a spreadsheet that … | |
Re: First of all the while loop is incorrect. Note that the insert() method is not neeced because simple concantination is all that is needed. [code] while( inputFile>>baseSentence ) { str1 = str1 + baseSentence + " "; } [/code] An even better way to do that is to replace that … | |
Re: very simple -- read and discard all the numbers up to the one you want to keep. A loop will be handy for that. |
The End.