15,300 Posted Topics

Member Avatar for huffstat

1. start a new empty project and call it qcard5. 2. Copy the *.cpp and *.h files from qcard4 into qcard5 directory 3. select menu Project --> Add To Project --> Files and select the files you want to add to the project. Mission accomplished.

Member Avatar for Ancient Dragon
0
433
Member Avatar for DavidR42

you can not initialize variables using calculations as shown at the beginning of your program (globals). Variables are initiailized only once when the program starts. If you want the program to do the calculations then you have to do them at the appropriate time, such as set the value of …

Member Avatar for DavidR42
0
160
Member Avatar for SegFaultSoul

And [URL="http://www.codeproject.com/dotnet/SettingWallpaperDotNet.asp"]here[/URL] is how to change wallpaper.

Member Avatar for Ancient Dragon
0
176
Member Avatar for jeffxiang

I'm certain there is a FAQ about this. The only way to do that is to rewrite the entire file. Read the whole file into memory then write it back out the way you want it. If the file is too big to read into memory all at once you …

Member Avatar for jeffxiang
0
422
Member Avatar for Woobag

use srand() to see the random number generator [code] int main(){ srand(time(0)); cout << getRand(); cin.ignore(2); } [/code]

Member Avatar for Rashakil Fol
0
190
Member Avatar for bibo1978

dev-c++ doesn't like strstream header file and claims it is deprecated. you should consider tossing it out of your program and using either iostream to display stuff on the console window or fstream to read/write to a disk file.

Member Avatar for bibo1978
0
246
Member Avatar for kris.c

>> fwrite (fp,i*sizeof(char),1,buff); there is no need for sizeof(char) because it is guaranteed by the language to always be 1 regardless of platform or compiler. Just makes less typing and fewer characters to read :mrgreen: fwrite (fp,i,1,buff);

Member Avatar for Dave Sinkula
0
138
Member Avatar for Umm...

See [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/ioctlsocket_2.asp"]ioctlsocket[/URL]

Member Avatar for Ancient Dragon
0
102
Member Avatar for Woobag

just a few coding style changes -- I like to make one-line functions inline -- saves keyboard typing :cheesy: [code]// Store creation for practicing Classes in C++ // Woobag float TOTAL_PRICE = 0.0; class cFood { protected: string type; float price; public: void setvalues(string, float) {type = i; price = …

Member Avatar for Ancient Dragon
0
252
Member Avatar for ganesh_i

[URL="http://www.google.com/search?hl=en&q=how+to+write+a+dll&btnG=Google+Search"]Tutorials[/URL]

Member Avatar for Ancient Dragon
0
88
Member Avatar for dev.cplusplus

See Microsoft's [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vctutor98/HTML/_gs_data_access_objects_.28.dao.29_.tutorial.asp"]Enroll Tutorial[/URL] and [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample/html/_sample_mfc_enroll.asp"]here[/URL] for an MFC solution. If you need to use Chinese character sets you can code for UNICODE by defining the macro UNICODE and _UNICODE in the project c++ settings. I don't know how that will affect the MFC database code that is presented in …

Member Avatar for Ancient Dragon
0
166
Member Avatar for BronxBoriqua
Member Avatar for ghadahelal
Re: I\o

I think you need a clearer definition of what you want. characters don't just "disappear" -- unless your a magician. Post an example of what you want. For example, if the word "hello" is read, do you want to delete the two 'l's and make it "heo"?

Member Avatar for Ancient Dragon
0
217
Member Avatar for CharlesTeck

If MSData is a c++ class then its destructor should delete all dynamically allocated class objects.

Member Avatar for Salem
0
192
Member Avatar for johnray31

implementation is normally in either a *.lib or *.dll and may or may not have the same name as the header file. You will probably not have the source code for system libraries and dlls. normally will NOT have the same name because libraries and DLLs contain implementation for many …

Member Avatar for johnray31
0
197
Member Avatar for luckycharms3657

what operating system and compiler are you using? Some of the code appears to be MS-Windows 32 api functions, but I don't know what the rest is -- gotoxy() is a TurboC MS-DOS function, there is no such thing for MS-Windows GUI programs.

Member Avatar for luckycharms3657
0
527
Member Avatar for waseem3000

>> int elements[] ={0}; This array only has one elelement and its value is 0 >> while(integer != -1) I'm supprised this loop works at all! variable [b]integer[/b] is unitialized and contains some random value. >> elements[counter]=integer; you can't resize an array like that. If you want to make the …

Member Avatar for Lerner
0
269
Member Avatar for gampalu

[QUOTE=gampalu]Sorry to be boring but I want to count the number of strings only in the first line. I mean a string each group of one or more caracters limited by a space... Can you help me? I tried to use the code you indicated but without sucess...[/QUOTE] Those are …

Member Avatar for Dave Sinkula
0
411
Member Avatar for kris.c

post code. Since you use fopen() I assume this is a C and not C++. After fopen, just use fprintf() then fclose(). [code] char strp[] = "Hello World"; FILE* fp = fopen("myfile.txt","w"); fprintf(fp,"%s\n",strp); fclose(fp); [/code]

Member Avatar for Ancient Dragon
0
87
Member Avatar for Pacer

>>disp.c:29:9: empty character constant >> if(c<''||c>0x7e) there is no character between the single quotes. you probably meant to put a space there?? Another bug: >>}while(c!=EOF); the above is not needed because its not a do-while loop.

Member Avatar for Pacer
0
200
Member Avatar for angle188.shroff

Why does that first error not supprise me. :eek: The so-called code you posted in red is not code at all. I have no idea what it is. You can't just type in some crap into the program and expect the compiler to understand it. The only valid error is …

Member Avatar for angle188.shroff
0
153
Member Avatar for TMcIsaac

download [URL="http://www.programmersheaven.com/zone8/cat121/32947.htm"]this[/URL] brief example program. and look at tic2a.c. It uses non-standard functions but might work with your compiler if you include conio.h.

Member Avatar for nanodano
0
259
Member Avatar for Omher

there is no bug in GetTickCount(). The reason it wraps around is that a DWORD can only hold a finite number of milliseconds and it reaches its maximum at 49.7 days. So if your program runs longer than that without being stopped and restarted, then you will have to compensate …

Member Avatar for dev.cplusplus
0
440
Member Avatar for tlly

[QUOTE=iamthwee]What is this '[I]google[/I]' you talk of? :?:[/QUOTE] Its a search engine for the internet. see [url]www.google.com[/url]. type in a key word(s) and it will try to find it. Sometimes it works ok, but often it will return trillions of answers :mrgreen:

Member Avatar for Dave Sinkula
0
214
Member Avatar for fawadhq

create a structure that contains the items for each record in the file. Then either create a linked list or an array of these items and read the file into the structures. You will want to rewrite all this information before the program ends so that the changes will be …

Member Avatar for hammerhead
0
131
Member Avatar for static

there are a lot of errors in that code. For example, in a linked list, the [b]next[/b] item is supposed to point to the next node in the list. [code] start->next >>> node->next >>> node->next ... [/code] The end of the linked list is noted when [b]next[/b] == NULL. Your …

Member Avatar for Ancient Dragon
0
131
Member Avatar for Joncamp

[QUOTE=Joncamp]I'm running Apache 3.0, and have a c++ cgi-bin program working fine with Apache... [/QUOTE] Then your program is NOT "running fine with Apache" :cheesy: Did you check the read/write permissions on the directory in which the program is attempting to write?

Member Avatar for Joncamp
0
117
Member Avatar for gampalu

[QUOTE=gampalu]Hi! I built this class, however when I executed my program the memory run out quickly, because I wasn't making any "deletes", so I added the delete in the destructor, but It crashes there... what's wrong? [/QUOTE] Nothing wrong with what you posted -- its impossible to tell what the …

Member Avatar for Salem
0
358
Member Avatar for Joncamp

in *nix they are [URL="http://www.dwheeler.com/program-library/Program-Library-HOWTO/index.html"]shared libraries[/URL]

Member Avatar for Joncamp
0
100
Member Avatar for YoTaMiX

a matter of correct typcasting. Note placement of asterisks and other typcasts in the scanf() line. I did not run your program so I don't know if it really works right. [code] case 1 : { user_array=(int*)malloc(size_of_input*(sizeof(int))); if (user_array==NULL) { printf("MEM ALLOC FAILED\n"); exit(1); } else { printf("Enter Data to …

Member Avatar for Ancient Dragon
0
176
Member Avatar for grautu

maybe this will help [code] #define _WIN32_WINNT 0x500 #include <iostream> #include <windows.h> using namespace std; int main() { HWND hWnd = GetConsoleWindow(); ShowWindow(hWnd,SW_MAXIMIZE); cout << "Hello World\n"; cin.get(); return 0; } [/code]

Member Avatar for grautu
0
209
Member Avatar for Tamir

maybe [URL="http://support.microsoft.com/?scid=http%3a%2f%2fwww.support.microsoft.com%2fkb%2f309294%2fen-us%2f"]this[/URL] will help. But this will be a great deal easier if you learn to use VB.NET -- you can mix and match VC++.net and VB.net functions.

Member Avatar for Tamir
0
491
Member Avatar for harrypotter

your program works ok with my compiler (VC++ 6.0). what compiler and os are you using. did you include stdio.h header file? And after changing the value of the "a" variable don't forget to recompile your program.

Member Avatar for Sulley's Boo
0
114
Member Avatar for achala

I think what you will probably want to do is remove the word(s) from the strings. If you use c++ and std::string, use string's find method to locate the word then use its substring method to remove it.

Member Avatar for SpS
0
102
Member Avatar for grautu

The functions FindFirstFile() and FindNextFile() will iterate the all the files and sub-directories. For each file they return a structure that contains the filename, attributes, size and other data. Check the file's attributes to see that it is a normal file and, if it is, your program can open and …

Member Avatar for grautu
0
199
Member Avatar for papermaker

Sorry, but I don't think you can write a c++ program to fix that problem.:mrgreen:

Member Avatar for Dave Sinkula
0
32
Member Avatar for agarunk
Member Avatar for yuzhang

[QUOTE=sunnypalsingh]Why are you casting [b]strlen[/b]. There's no need for that.[/QUOTE] there is if you use vc++ 2005 -- strlen() returns size_t (unsigned int) with that compiler.

Member Avatar for Ancient Dragon
0
168
Member Avatar for yuzhang

If you are compiling a C program as C++ (with .cpp extension instead of .c extention), then you will have to typecase malloc because the compiler is compiling it as a c++ program, and c++ requires the typecase. If, on the otherhand, the file is *.c extension, then no typecase …

Member Avatar for Ancient Dragon
0
100
Member Avatar for CStallion

use a vector if you want an array of strings. [code] #include <string> #include <vector> using namespace std; int main() { vector<string> array(5); // initialize to be an array of 5 strings switch(z) { case 0: array[0] = "entry 1"; array[1] = "entry 2"; ... } } [/code]

Member Avatar for SpS
0
448
Member Avatar for yuzhang

you need to make the linked list global so that it is visible to all other functions.

Member Avatar for Ancient Dragon
0
159
Member Avatar for yuzhang

This looks like it should be a linked list of messages. You need to allocate an object that represents the head of the linked list, then add nodes to it. One way might be like this [code] void sqEnqueue(struct Message_from_server** head, const char *s) { struct Message_from_server* new_node = malloc(sizeof(struct …

Member Avatar for Dave Sinkula
0
136
Member Avatar for Croft .L

[URL="http://www.microsoft.com/downloads/Browse.aspx?displaylang=en&categoryid=2"]DirectX[/URL] for MS-Windows os. is free, and includes some examples. Definitely not for beginners.

Member Avatar for nanodano
0
375
Member Avatar for type-r
Member Avatar for rajkaC

use ODBC calls to connect to databases. See google for lots of examples and a few c++ classes. But you cannot do that at all with Turbo C because that compiler is too old, you will have to upgrade to a new compiler like Borland Builder, Dev-C++, or Microsoft VC++ …

Member Avatar for Ancient Dragon
0
106
Member Avatar for complete

All the programs I write are MFC programs. Why? Because they can be written in less than 1/4 the time as pure win32 api programs. And you are not limited to just MFC -- you can mix and match as needed with win32 functions. On the negative side, MFC makes …

Member Avatar for dubeyprateek
0
440
Member Avatar for ontrix

hint: look for function Sleep() which uses milliseconds. And 100 is about as accurate as it can get, depending on what other processes are running on the computer.

Member Avatar for Ancient Dragon
0
398
Member Avatar for gampalu

my quick test using VC++ 2005 Pro shows that cout is faster than printf [code] #include <cstdio> #include <ctime> #include <fstream> #include <iostream> using namespace std; int foo1() { clock_t t1,t2; t1 = clock(); for(int i = 0; i < 100000; i++) printf("Hello World\n"); t2 = clock(); return t2 - …

Member Avatar for Dave Sinkula
0
131
Member Avatar for mhm_ra

Do you mean the address contained in the pointer or the object to which it points. What kind of pointer do you have in mind? Writing the address to a file is useless because it cannot be simply read back in later and expect it to point to the same …

Member Avatar for Ancient Dragon
0
148
Member Avatar for lchamarthi

[QUOTE=Narue] But for portability reasons, you can't assume more than -32,767 to +32,767. [/QUOTE] Use the limits in limits.h if you want portability.

Member Avatar for Ancient Dragon
0
206

The End.