15,300 Posted Topics

Member Avatar for justin96b

My bet is that you copied some code from the net that was written with VC++ 2010 Express and you are trying to compile it with gcc??? _TCHAR is a macro defined in tchar.h. You can just replace it with char* so that the line looks like this: [icode]int main(int …

Member Avatar for Nick Evan
0
150
Member Avatar for becool007

can't really say the problem without seeing main.h. You probably did not write the implementation of those methods. In any event, get/set methods should not be static because static methods do not have access to instance data.

Member Avatar for Ketsuekiame
0
252
Member Avatar for MooGeek

I have a FB account, and twitter too, but rarely use them. But I see your point about labs. I'm a PT WalMart cashier and I could imagine what would happen if I brought a laptop to the register and was on FB all the time. When a customer comes …

Member Avatar for Netcode
4
502
Member Avatar for manugm_1987

If you use [URL="http://msdn.microsoft.com/en-us/library/ms682425(v=vs.85).aspx"]CreateProcess()[/URL] instead of system() to spawn Notepad.exe then CreateProcess() will give you the thread id. Here is an example. The PROCESS_INFORMATION structure will contain the data you are looking for. [code] #include <Windows.h> #include <iostream> using std::cout; int main() { PROCESS_INFORMATION pinfo; STARTUPINFO sinfo; memset(&sinfo,0,sizeof(sinfo)); sinfo.cb = …

Member Avatar for Ancient Dragon
0
354
Member Avatar for logicmonster

>>string_size = sizeof(argv[count]); Line 20 of main(). sizeof returns the size of the argument, not the length of the string. Since argv[count] is just a pointer, sizeof(argv[count]) is the same as sizeof(char*) which is normally 4 on most 32-bit compilers today. What you probably want is [icode]string_size = strlen(argv[count]);[/icode]

Member Avatar for Ancient Dragon
0
168
Member Avatar for drakeanoid

why is menu() doing recursive calls in each of those case statements? There is no need for that and those lines should be deleted. The program will return back to the top of that while statement without doing recursion. Line 113 (return) is not needed either. The loop will just …

Member Avatar for Ancient Dragon
0
593
Member Avatar for banoth suman

call getline() to extract the variables one at a time using the comma as deliminator. There are several ways to do it, here is just one of them. Note that I did not compile or test the following code [code] #include <fstream> #include <string> using std::string; using std::ifstream; int main() …

Member Avatar for Ancient Dragon
0
252
Member Avatar for bunteezone

>>for example if I enter the file name as "1234567" (only digits), It should create "0001234567_OP.txt" [code] #include <sstring> #include <string> #include <fstream> using namespace std; int main() { int num = 12345; string filename; stringstream str; str << num; // converts num to a string filename = "000"; filename …

Member Avatar for santanu@code
0
30K
Member Avatar for Kadence

[QUOTE=Kadence;913446] The above doesn't give a compiler error for me, although it doesn't evaluate the or condition.[/QUOTE] If using a Microsoft compiler you have the wrong macros [icode]#ifdef _WIN32 || _WIN64[/icode]

Member Avatar for Susel1
0
3K
Member Avatar for triumphost

>> for int main() why do we always have to write return 0? Its optional in c++ but not in C. The reason is because the c++ standards say its optional. If you don't specify a return value then return 0 is assumed. MS-Windows and *nix operating systems do nothing …

Member Avatar for SnowFall
0
273
Member Avatar for happygeek

I would have thought texting is much more popular today than email, twitter or facebook. People are always texting, even while driving (and getting into accidents)

Member Avatar for GrimJack
1
4K
Member Avatar for Satyrn

A simple search and replace program would probably to the job. You could probably write your own in a couple hours or get a fancier one on the net (use google).

Member Avatar for Ancient Dragon
0
116
Member Avatar for donaldw

What version of VC++ are you using? I hope its not 1.52C :twisted: MS-Windows sends out a WM_PAINT message when one of the events you mehtioned happens. [URL="http://www.gidforums.com/t-10398.html"]Here[/URL] are a few suggestions how to do it. Capture the WM_PAINT event or implement OnPaint() method, which one to use depends on …

Member Avatar for Ancient Dragon
0
131
Member Avatar for detailer

@detailer: what compiler are you using? If it doesn't recognize namespace then it may be Turbo C++? The behavior of Ctrl+C is operating system dependent. With most MS-Windows compilers and console programs it causes the program to terminate immediately. On other operating systems Ctrl+C may do nothing at all. You …

Member Avatar for Ancient Dragon
0
254
Member Avatar for Amr87

That question has been asked and answered several times -- see one of [URL="http://www.daniweb.com/forums/search.php?searchid=18463007"]these threads[/URL]

Member Avatar for Ancient Dragon
0
68
Member Avatar for ed_shaw

[QUOTE=ed_shaw;1604590]If I wanted a lecture in jihad appeasement from the politically correct, I would have requested one. I'm not interested in discussing the issues. Maybe one of the members has the guts to offer up something on the requested subject.[/QUOTE] Your the one who started this crappy thread, so don't …

Member Avatar for Seten
-3
232
Member Avatar for dotancohen

ip is just an int pointer because it has not been set to point to a particular object. [icode]int x = 1; int* ip = &x;[/icode] is a pointer to a variable of type int. ip could also be a pointer to an array of ints [code] int nums[3] = …

Member Avatar for keshvari
0
197
Member Avatar for sayoojya

[QUOTE=sayoojya;1173311]Write a C program to find the factorial of a number using do while loop?[/QUOTE] No. You will have to write that yourself.

Member Avatar for dharini6030
-8
9K
Member Avatar for senergy

mysql++ works with VC++ 2010. Must be something you are doing incorrectly. Post some code so that we can see what you are doing.

Member Avatar for Ancient Dragon
0
328
Member Avatar for little_bee

Here is one common example: Write a program that sorts an array of 10,000 random integers using four different sort algorithms, then compare the results (time each one to find out which is fastest).

Member Avatar for Adak
0
128
Member Avatar for tubby123

[b]extern[/b] means the variable may be declared in another source file or later in the same source file. See the remarks [URL="http://msdn.microsoft.com/en-us/library/0603949d(v=vs.80).aspx"]here[/URL] Also, the value of global variables are set before main() is called, which is why printf() can display the correct value of that variable.

Member Avatar for Narue
0
94
Member Avatar for MarounMaroun

fscanf() won't work for you if the line contains any spaces or tabs. Its better to just use fgets() to avoid that problem. And a better way to code the while statement is like this: [code] while( fgets(data, sizeof(data),separators_f) ) { char* ptr = strtok(data,","); i = 0; int line[5] …

Member Avatar for Ancient Dragon
0
128
Member Avatar for imstarting

I tried a video tutorial once for another language but quickly found out that it was just too difficult to follow the tutorial and type the information into my IDE at the same time. I much prefer books where I can learn at my own pace.

Member Avatar for m4ster_r0shi
0
250
Member Avatar for sabareesh
Member Avatar for Stefano Mtangoo
Member Avatar for vijayan121
0
853
Member Avatar for iamthwee

>>It will probably also mean the end of US military imperialism (if the leaders are at all sensible). And good, its about time US stops trying to be the world police force. IMHO we need to stop fighting other countries wars for them and stop instigating them.

Member Avatar for iamthwee
0
143
Member Avatar for AshfaqueIW

You could use an array of function pointers and the index into the array could be the case values, for example [code] typedef struct { int (*fn)(); }fns; int f1() {return 0;} int f2() {return 0;} int f3() {return 0;} int f4() {return 0;} int f5() {return 0;} int f6() …

Member Avatar for mrnutty
0
1K
Member Avatar for fatalaccidents

The difference is that class* is a pointer passed by value, while class*& is a pointer passed for reference. Another way to do it is to pass class** (note two stars). Its the same idea as passing an int (or anything else for that matter), such as int is passed …

Member Avatar for fatalaccidents
0
107
Member Avatar for Sadun89

[URL="http://thelongestlistofthelongeststuffatthelongestdomainnameatlonglast.com/long42.html"]Longest name in the world[/URL]

Member Avatar for zachf632
0
222
Member Avatar for abdelhakeem

[quote] You reached 194 points, so you achieved position 78789 of 308040 on the ranking list You type 297 characters per minute You have 48 correct words and you have 3 wrong words [/quote] I slowed down a bit in the past 20 years.

Member Avatar for nick.crane
0
451
Member Avatar for menonnik

what kind of an array are you talking about? use strchr() or strstr() with character arrays.

Member Avatar for menonnik
0
240
Member Avatar for keevin

The first example could be shortened like this [code] string format(double Value, int nPrecision) { char buffer[100]; //Buffer where to store the resulting formatted string. sprintf(buffer,"%0.*f",nPrecision,Value); //Print formatted data to a string return (string)buffer; } [/code] or [code] string format(double Value, int nPrecision) { stringstream s; s.width(nPrecision); s << Value; …

Member Avatar for basrikul
0
436
Member Avatar for jaepi

>>is this the right way? No because atoi() takes a pointer to a null-terminated string and your variable temp is just a single character. The quickest way is to simply subtract the ascii value of '0' from it like this: [inlinecode]int n = temp - '0';[/inlinecode]. Why does that work? …

Member Avatar for WaltP
0
1K
Member Avatar for emmas4impact

First, don't use exit(). You need to add a loop to your program so that if you answer 'Y' then the program will just loop back to the beginning and start all over again [code] void addCustomer() { char answer; do // beginning of loop { // put your code …

Member Avatar for emmas4impact
0
162
Member Avatar for Prankmore

scanf() expects the prameters to be pointers so that it can change the variables values. [b]num[/b] is just an integer, not a pointer, so put the & pointer operator in front of it. [icode]count = scanf ( "%s%n", phone, &num );[/icode] Also see [URL="https://buildsecurityin.us-cert.gov/bsi/articles/knowledge/guidelines/340-BSI.html"]this article[/URL] about %n.

Member Avatar for Prankmore
0
185
Member Avatar for mrcpp

For *nix you will want to study [URL="http://en.wikipedia.org/wiki/Motif_(widget_toolkit)"]Motif[/URL], which is not free unless you use [URL="http://www.openmotif.org/"]OpenMotif[/URL]. If you don't want their tools either then use [URL="http://www.x.org/archive/X11R6.8.0/doc/RELNOTES4.html"]X11R6[/URL] (there might be newer versions though). I'm sure you will find tutorials with google. And if you are going to write an extensive toolkit …

Member Avatar for Ancient Dragon
0
418
Member Avatar for arlir

The statements starting on line 46 are not constructed correctly. [icode]if( category == 'T' || category == 't')[/icode] You don't want to call getchar() inside each of those if statements. Its already called on line 45 so all you have to do is use the value of category.

Member Avatar for muktigeek
0
234
Member Avatar for creative_m

What do you mean "it does not work"? Would you take your car to a repair shop and tell the mechanic the same thing? I hope not. Is that CLR/C++ code (e.g. Windows Forms) you posted? If so, you can not use the standard templates like you would in c++. …

Member Avatar for Ancient Dragon
0
292
Member Avatar for fashxfreak

Yes it does -- you must be doing something wrong or looking in the wrong place for the *.exe file.

Member Avatar for Ancient Dragon
0
108
Member Avatar for reallyslick

I would make an array of tags then all the program needs to do is iterate through the array -- a lot easier than creating 50+ if statements. The array will make it a lot easier to add and/or delete tags too. [edit]arkoenig has a better solution -- use a …

Member Avatar for reallyslick
0
189
Member Avatar for hqt

Dev-C++ sucks. Use Code::Blocks. I don't know if it will solve that specific problem but it is a lot better IDE which is currently supported by whoever wrote it, unlike Dev-C++ where support is long dead.

Member Avatar for pseudorandom21
0
145
Member Avatar for happygeek
Member Avatar for DesignGhosts

line 3 of sortBuff(). That array should be declared as char, not int because you are putting alphanumeric characters into it, not integers. line 19 of sortBuff() -- why is that check even necessary? [code] while( line[i] != '\0') { if( line[i] == ':') { ++line; hexChar = 0; } …

Member Avatar for DesignGhosts
0
239
Member Avatar for pranavghodke

Post the code that you have attempted. No one here is going to write your homework program for you.

Member Avatar for Ancient Dragon
0
65
Member Avatar for sadsdw

The loop on line 37 will cause the stream to read the last line in the file twice. What you want is like below -- not necessary to test for eof() because getline() will stop when eof() is encountered. [code] while( getline(IN_transposeRowColumn,row) ) { // other code goes here } …

Member Avatar for Ancient Dragon
0
142
Member Avatar for praveendesilva

[URL="http://msdn2.microsoft.com/en-us/library/ms227408(VS.80).aspx"]Here[/URL] are some tutorials

Member Avatar for Netcode
0
669
Member Avatar for Serunson

I'm listening to a Moody Blues concert on PBS that was recorded in 2000. Great stuff if you like music of the 1970's and 80s. They were the first group to integrate a full orchastra with rock and it sounds great. I don't know if any other group has ever …

Member Avatar for blackcathacker
0
1K
Member Avatar for sadsdw

You're going to need a 64-bit version of the file i/o functions. For MS-Windows you can use [URL="http://msdn.microsoft.com/en-us/library/aa365467(v=vs.85).aspx"]ReadFile()[/URL] win32 api function. Don't know about *nix. I know ReadFile() isn't as convenient as fstreams, but AFAIK the only way to get 64-bit version of fstream is to use a 64-bit compiler. …

Member Avatar for sadsdw
0
258
Member Avatar for jobs

>>Have I got this right so far? Yup -- that's all there is to it. Hopefully you are not writing a multi-threaded program :)

Member Avatar for Narue
0
1K
Member Avatar for pseudorandom21

Sounds like Ron Paul's a winner to me, but that's not likely to happen. >>P.S. What happened to the bad word filter? The word "shit" is not considered a bad word -- daytime American tv rule.

Member Avatar for pseudorandom21
0
660

The End.