15,300 Posted Topics

Member Avatar for harikrishna439

fflush(stdin) is non-standard and not supported by many compilers. fflush is used to force the operating system to write everything to the output stream. Since stdin is an input stream and not an output stream fflush(stdin) may or may not work, depending on what comiler you use.

Member Avatar for Ancient Dragon
0
86
Member Avatar for YingKang

what compiler are you using? what operating system? what are the error messages?

Member Avatar for mike_2000_17
0
749
Member Avatar for effizy

Here is one way to prevent duplicates BTW: assert() does nothing when the program is compiled for release mode instead of debug mode. [code] void uniquebag::insert(const value_type& entry) { assert(size () < CAPACITY); // check if the number already exists in the array bool found = false; for (size_type i=0; …

Member Avatar for effizy
0
94
Member Avatar for senche

There is no such thing as "Non Ansi C Standard". If its not in the Ansi C Standard then it must be, by definition, non-ansi C.

Member Avatar for N1GHTS
0
996
Member Avatar for malvi

The same way you would do it in a normal c++ program. [code] #include <vector> int main() { std::vector<int> array; } [/code] MFC has a lot of container classes, and depending on what you want to do, they may or may not be better than std::vector or std::list. Your compiler …

Member Avatar for Rajesh R Subram
0
113
Member Avatar for dspjm
Member Avatar for mmmm1118

So, you want to send something to a printer? What operating system? Is the printer connected directly to your computer or is it located on a network? Lazer printer or line printer?

Member Avatar for Ancient Dragon
0
40
Member Avatar for SamSmiles

use fgets() to read a line, then for each line you can use strtok() to tokenize it, then atol() to convert from char* to int. Another way is to use strtol() in a loop. Example [code] int main() { char line[] = "12 23 34 45"; char* ptr; int n1[4]; …

Member Avatar for Ancient Dragon
0
112
Member Avatar for Sodrohu

You have to call [URL="http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx"]CreateFile()[/URL] to open the comm port. Then you use the win32 api [URL="http://msdn.microsoft.com/en-us/library/aa363194(VS.85).aspx"]Communications Functions[/URL]

Member Avatar for Ancient Dragon
0
206
Member Avatar for Ancient Dragon

It sometimes includes threads that I have recently answered. For example, click Unanswered Threads, post in one of them, then click Unanswered Threads again -- the thread you posted in still shows up, but this time it shows correctly that there was 1 reply. I would have expected it to …

Member Avatar for Fbody
0
122
Member Avatar for koti86
Member Avatar for Ancient Dragon
0
90
Member Avatar for Garrett2011

Are you talking about precompiled header files? Both Microsoft's VC++ 2010 (and earlier versions too) and g++ support that (other compilers might too, I don't know). You have to create a header file that includes other header files as well as function prototypes, constants, classes, structures and externs. Then you …

Member Avatar for Garrett2011
0
217
Member Avatar for Falkoner1

Freeky -- again, that code requires the use to hit the Enter key Nishinoran: since your program is already using kbhit() when the program returns to the place to begin getting keys from the keyboard you can flush all the keys with another loop using kbhit [code] while( kbhit() ) …

Member Avatar for burcin erek
2
476
Member Avatar for burcin erek

OMG I hope he is not taking a college course ;) A better way to write that. Note that you don't need all those C header files. [code] #include <string> int main() { for(int i = 0; i < 1000; i++) { std::cout << i << '\n'; } std::cin.get(); return …

Member Avatar for burcin erek
0
225
Member Avatar for Barca

Yes of course its possible. All you have to do is rewrite the entire file [code] open input file for read open temp output file for writing for read line read from input file remove what you want from the line write the rest to the output file close both …

Member Avatar for Barca
0
159
Member Avatar for patrick772goh

you can not use strcat() on the pointer returned by [URL="http://www.warpspeed.com.au/cgi-bin/inf2html.cmd?..%5Chtml%5Cbook%5CToolkt40%5CXPG4REF.INF+148"]getcwd[/URL]() because _getcwd() allocates a buffer only large enough to hold the path. You need to allocate a second buffer that is large enough to hold the string returned by _getcwd() and the string you need to add. The second …

Member Avatar for Mr.What
0
392
Member Avatar for NicAx64
Member Avatar for Taimur.Ace

He could post the same thing in [URL="http://www.daniweb.com/forums/forum95.html"]Job Offers[/URL] without getting flamed or getting his phone number snipped.

Member Avatar for NicAx64
-2
360
Member Avatar for N1GHTS

It might be safer to use a union, such as [URL="http://msdn.microsoft.com/en-us/library/ms221627(v=VS.80).aspx"]VARIANT[/URL].Your structure does not have to be that complicated [code] typedef struct { int type; union { char cVal; int iVal; float fVal; } val; }AnyVal; int main() { AnyVal val; val.type = TYPE_FLOAT val.val.fVal = 0.0F; } [/code]

Member Avatar for N1GHTS
0
111
Member Avatar for GURTEJ UBHI

This is c++ forum, not C. Here is one way to do it, but I doubt that is that you really want. [code] int main() { cout << 3 << '\n'; cout << 323 << '\n'; cout << 32123 << '\n'; cout << 323 << '\n'; cout << 3 << …

Member Avatar for Ancient Dragon
-3
76
Member Avatar for fire_

[URL="http://msdn.microsoft.com/en-us/library/12h9x0ch(v=VS.80).aspx"]CComboBox[/URL] does not have an items property. [icode](CComboBox*)(GetDlgItem(IDC_COMBO1))->AddString("Text");[/icode]

Member Avatar for Ancient Dragon
0
117
Member Avatar for neoraghav

you have to check for error, and if it occurs clear the input buffer See [URL="http://www.daniweb.com/forums/thread90228.html"]this thread[/URL] about how to clear the input buffer. [code] #include <iostream> #include <limits> using std::cin; using std::cout; int main() { int c; while(true) { cout << "Enter a number\n"; cin >> c; if( cin.fail() …

Member Avatar for neoraghav
0
153
Member Avatar for tomtetlaw

[URL="http://delphi.about.com/od/adptips2006/qt/vkey2char.htm"]Here [/URL]is an example, I think its in vb but you should be able to translate it easily to C.

Member Avatar for Ancient Dragon
0
198
Member Avatar for neoraghav

include windows.h win32 api function [URL="http://msdn.microsoft.com/en-us/library/ms682453(VS.85).aspx"]CreateThread()[/URL] More about that [URL="http://www.codeproject.com/KB/threads/Threads_1.aspx"]here[/URL]

Member Avatar for Ancient Dragon
0
287
Member Avatar for falconwise

Line 3: that is not the way to pass an array. Omit the []. All you do is pass the name of the array, like this: [icode]mergesortinplace(0, (length/2), array);[/icode]

Member Avatar for falconwise
0
222
Member Avatar for Firestone

The program will not stop if there are still keystroks in the keyboard buffer, such as if you previously called scanf() to get an integer the '\n' will still be in the keyboard buffer. But you will have to post your program for anyone to give you more help with …

Member Avatar for Narue
0
2K
Member Avatar for neoraghav

You don't link the dll -- only the *.lib. One way to do it is by using pragma [icode]#pragma comment(lib,"mydll.lib") [/icode] Replace mydll.lib with whatever you named it. You will have to put the dll in either the program's current working directory or one of the folders specified in the …

Member Avatar for neoraghav
0
202
Member Avatar for ragoo

Variable x is not being changed inside that loop, so it will print the same value of x to the file 20 times.

Member Avatar for Ancient Dragon
0
70
Member Avatar for palaweb

Are you telling us that you are an illegal immegrant to one of those countries? If you are -- then Shame on you.

Member Avatar for Ancient Dragon
0
130
Member Avatar for knellgust

What does the program not do that you want it to do? What are the errors? We are not here to debug and fix errors in your program, but to help you do it yourself. But before we can do that you have to know what te problems are.

Member Avatar for Stefano Mtangoo
0
105
Member Avatar for hammer40

You have my sympathies on your job loss. A lot of companies are screwing over their older works for the very reasons you suggest. And the IT field is not immune. I've heard a lot of horror stories about age discrimination in the IT industry. Anyone over about 25 is …

Member Avatar for vaibhav1983
0
451
Member Avatar for muze

Do you want managed or unmanaged code. Its pretty easy with unmanaged code -- just google for ODBC. I'm not sure how you can do it with c++/CLR or C# programs.

Member Avatar for Ancient Dragon
0
124
Member Avatar for nv136

>>can anyone give me their explorer.exe and explorerframle.dll ? (64bit Can I? Yes. Will I? No. Reinstall the operating system.

Member Avatar for caperjack
0
155
Member Avatar for roh_gang

If you are USA citizen or legal immigrant then join the US military. They will give you all the free training you will want. Most colleges and universities in USA have Cadet programs that let you attend college full time and give scholarships to help pay for tuition etc. I …

Member Avatar for maverick123
0
163
Member Avatar for ehsantl

[code] void City::setNextCity(City city) { nextCities->push_back(&city); }; [/code] You can't do it like that because the parameter is a copy of City class, and will be destroyed as soon as setNextCity() exits. You need to make list own all the memory so that it doesn't rely on anything outside of …

Member Avatar for ehsantl
0
172
Member Avatar for samuel_1991

What you want is a character array [icode]char buffer[255];[/icode] That declares an array of 255 characters. c++ also has a std::string class, but you can not use that with SqLite database. You have to be careful about allocating new memory in a DLL. Memory allocated in a dll with new …

Member Avatar for samuel_1991
0
724
Member Avatar for WayWithWords

Post them in Business Exchange --> Looking To Hire. >>I'm also a social media geek with a good sense of humor. Can I stay? No -- we don't allow people with a good sense of humor here. Go away :) (Just kidding)

Member Avatar for JohnnySaur
0
172
Member Avatar for Glass_Joe

Does Tom Hudgson = Glass Joe? Must be nice to get paid for playing games :) Do you know if its available on MS-Windows 7? Or just PSN and Xbox Live? Oh well, its probably too difficult for an old man like me anyway. I have yet to play Donkey …

Member Avatar for Glass_Joe
1
443
Member Avatar for neoraghav

Making the file "read only" will NOT prevent an external application or the user from changing or deleting it. It mearly makes it more inconvenient. External applications or the user can always change the file permissions to read/write and either change the file's contents or delte it. If you want …

Member Avatar for neoraghav
0
2K
Member Avatar for Exile_082

The first line just declares a variable of type std::string The second line causes all keyboard input up to the '\n' (carriage return) to be sent to the string object. So if you typed "Hello World" <Return key> then the string subChoice would contain "Hello World". Copy and paste this …

Member Avatar for Fbody
0
190
Member Avatar for chun0216

You are wasting your time and efforts trying to optimize that. There are only a few clock ticks difference between the two, and any optimizing you do with that will not even be noticable. Concentrate first at the function level -- do some profiling to see where the bottle necks …

Member Avatar for kes166
0
110
Member Avatar for muze

One way is not to Sleep() for so long [code] while(true) { Sleep(300); // sleep 30 seconds if( time to waik up) break; } [/code]

Member Avatar for muze
0
135
Member Avatar for murwadar

Welcome to DaniWeb. Make sure you are familiar with the [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]Rules[/URL] because you will get into trouble here if you don't write in full English words, such as "you" instead of u. >>Do not write in all uppercase or use "leet", "txt" or "chatroom" speak

Member Avatar for AndreRet
0
17
Member Avatar for harikrishna439
Re: gets

[URL="http://www.gidnetwork.com/b-56.html"]Don't use gets()[/URL] Read that link -- it contains a lot of good-to-know dos-and-don'ts.

Member Avatar for gerard4143
0
112
Member Avatar for gunbuster363

Also maybe your comnputer has too little RAM. It needs at least 2 gig. Check the amount of free hard drive space available. The OS will get very slow if the hard drive is nearly full.

Member Avatar for Ancient Dragon
0
281
Member Avatar for Davidm44

What version of MS-Windows? The program has to have permissions to start services.

Member Avatar for Davidm44
0
73
Member Avatar for gunbuster363

Programmers use [URL="http://en.wikipedia.org/wiki/Include_guard"]code guards, sometimes called include [/URL]guards, to avoid the problems with double inclusions. You will find them used in almost (if not all) the standard header files that are installed with your compiler. When used, they would prevent the problem like the example presented by evstevemd, above.

Member Avatar for gunbuster363
0
1K
Member Avatar for burcin_erek

You mean like this? [code] #include <conio.h> #include <iostream> using std::cout; using std::cin; int main() { char c; while(true) { cout << "Enter a character\n"; c = getche(); if( islower(c) ) cout << "\nLower\n"; else cout << "\nNot lower\n"; } } [/code]

Member Avatar for burcin_erek
0
83
Member Avatar for desertdenizen

Welcome to DaniWeb. For readers who are not from USA, AZ is the abbreviation for the state of Arizona, home of one of the World's Greatest Natural Wonders, the Grand Canyon.

Member Avatar for mackone
0
127
Member Avatar for king chandel

No. Windows win32 api functions require a 32-bit compiler. Turbo C is a 16-bit compiler. Come into the 21st century and get either free Code::Blocks or vc+ 2010 Express.

Member Avatar for Adak
0
139

The End.