15,300 Posted Topics

Member Avatar for jazzz

convert the strings to a have fixed-length fields [code] 7379->65535->65535 7315-> 5->65535 [/code] The the above, just to a simple comparison

Member Avatar for iamthwee
0
2K
Member Avatar for nanodano

look at [url]www.microsoft.com[/url] for [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createthread.asp"]CreateThread[/URL]() win32 api function. It looks like a lot of parameters but you can leave most of them 0. I don't know if you can use the same stream object between threads or not (not sure if they are thread-safe). Even if they are, the two …

Member Avatar for dubeyprateek
0
115
Member Avatar for yuzhang

>>"MESSAGE ""%s""\r" The reason this doesn't work the way you want it is because that is a standard way of concantinating string literals and the compiler will just make one string out of it. char str[] = "Hello " "World" is the same as this char str[] = "Hello World"

Member Avatar for yuzhang
0
275
Member Avatar for achala

[QUOTE=Narue]Sorry, but you wore out your code. The only way to fix the problem is to print the source out and then type it all back in fresh. This also happens when you let code sit too long and it starts to rot..[/QUOTE] :cheesy: :cheesy: :cheesy: you really should have …

Member Avatar for Ancient Dragon
0
226
Member Avatar for CStallion

>>Now my guess is that the first block of code uses more memory at any given moment than the second one In the second example, a good optimizing compiler will notice that it only needs to allocate space for one std::string object and reuse this memory on each block entry. …

Member Avatar for CStallion
0
151
Member Avatar for CStallion

No there is no shortcut because changing the color is an os-specific function and ansii standards try to stay clear of those issues. -- but you might be able to write your own ofstream overloaded function that will accomplish that.

Member Avatar for CStallion
0
307
Member Avatar for aeinstein

In c and c++, char is sort of a misnomer -- it is meant to hold more than just characters, it is in fact a small one-byte integer and can be used just like integers of other sizes. unsigned char has a range of 0 to 255 (see limits.h for …

Member Avatar for aeinstein
0
173
Member Avatar for bkelly

you still have several 16-bit c/c++ compilers available: Turbo C/C++, Watcom and Microsoft Visual C++ Version 1.52C. The M$ compiler is difficult to find, but the Borland compilers can be easily downloaded free from their web site. The Watcom compiler is also free, but I'm not sure where to get …

Member Avatar for bkelly
0
133
Member Avatar for sufi

just open the file for writing, then output all user input to that file. Yes, you have to add additional code to do that. No, you can't have cout and cin do two things at the same time (write/read to/from the screen and write to a file too).

Member Avatar for Ancient Dragon
0
2K
Member Avatar for bibo1978

See any of [URL="http://www.google.com/search?hl=en&q=how+to+write+a+dll&btnG=Google+Search"]these google articles[/URL]. Many of them are for VB, but you can just ignore that part and read about how to write the dll. One important point: memory cannot be allocated in a dll and deallocate it in the calling application. Special non-ansi-standard functions such as GlobalAlloc() …

Member Avatar for Ancient Dragon
0
75
Member Avatar for sadronmeldir

The error is telling you that you are attempting to pass a pointer to a function, and the 1st parameter is supposed to be a float. Maybe you meant to code like this so that it calls giveX() which returns the float. [code] glVertex3f(pA.giveX(), pA.giveY(), pA.giveZ()); [/code] [edit]Sorry Dave -- …

Member Avatar for WaltP
0
314
Member Avatar for complete

depends on the operating system. For ms-windows, I use CreateThread() and CreateMutex(). see MSDN for details.

Member Avatar for complete
0
119
Member Avatar for ghadahelal

simple -- just typecast the float to an int. All decimals will be dropped, nothing rounded with this method. [code] float f = 12.345; int i = (int)f; [/code]

Member Avatar for ghadahelal
0
149
Member Avatar for CStallion

I think you're c++ program will have to change fonts before beginning to output the text. The font used by the c++ console program is not the same font that the IDE editor uses. The IDE does not use cout or other console output functions to write to the window …

Member Avatar for Ancient Dragon
0
3K
Member Avatar for immaldor

offhand, I'd say you don't have a complete installation of the compiler. Attached is a bitmap of the bin directory on my computer. Yours should be similar.

Member Avatar for immaldor
0
137
Member Avatar for yuzhang

you are confusing the ascii value of '3' (numeric value is 53) with the binary value of 3 (decimal value of 3). Look at an ascii chart and it will show you the ascii values of all 255 possible values that can be contained in unsigned char. If you want …

Member Avatar for Ancient Dragon
0
149
Member Avatar for Asif_NSU

works ok with Dev-C++ (version 4.9.9.2 which uses gcc), just had to add getchar() after the scanf() to flush the '\n' out of the keyboard so that I could see the results before the program terminated.

Member Avatar for Asif_NSU
1
1K
Member Avatar for lchamarthi

The best way to learn C is buy an Introduction to C book because none of the online tutorials are very good. all you will get online are bits and pieces -- a book will give you a thorough introduction. But say clear of the Dummies series -- not much …

Member Avatar for SpS
0
181
Member Avatar for yuzhang

In addition, if the file is NOT one the current working directory the program may have to change the current working directory to where the file is. There are a few operating systems where there is no concept of "current working directory", in which case the program has no choice …

Member Avatar for yuzhang
0
292
Member Avatar for yuzhang

FILE (all caps) normally refers to C file i/o functions, such as fopen(), fgets(), fread(), fwrite() and several others. The word "file" (all lower case) generally describes what is actually stored on the disk -- each file has a filename and size. >>Secondly, does the definition of "stdin" include this …

Member Avatar for yuzhang
0
184
Member Avatar for DotNetUser

Can't you just simply use std::vector? [code] vector<bool> array; [/code] It will grow as needed.

Member Avatar for Ancient Dragon
0
110
Member Avatar for j1979c

use the depends.exe that is in the vc++ 6.0 install bin directory to find out what dlls are required, then install those dlls with your program. You must take care not to overwrite newer versions of the same dll that is on the target machine. If you use an install …

Member Avatar for Ancient Dragon
0
137
Member Avatar for achala

You don't need that list at all. you alreay have map which you can use to map strings with their counts. Add the words to the map when read and you will not need the list at all. Also, the loop to read the file can be coded better [code] …

Member Avatar for achala
0
152
Member Avatar for SyxxtySyxx

If you have learned about liked lists then using a linked list to hold the words and their counts would be more efficient. But if you haven't learned about them yet, you can just use a simple array of a very large number -- say an array big enough to …

Member Avatar for Ancient Dragon
0
602
Member Avatar for alpha2006

VB is generally considered a toy. OK for your own personal enjoyment but not very well supported in commercial world. Managed .NET may change that perception in the future.

Member Avatar for Comatose
0
208
Member Avatar for yaoyaolin

>>I know sizeof(struct baseball) = 16. Not necessarily -- that is compiler implementation dependent. Just because one compiler says its 16 doesn't mean it will be the same for all compilers. The sizeof(Yankeys) is the sizeof(struct baseball) * numer of elements in the Yankeys array. And the number of elements …

Member Avatar for Ancient Dragon
0
109
Member Avatar for johnray31

what's wrong with the Dev-C++ compiler? It compiles both C and C++ ok. If you want it to compile C only, then make the filename extension *.c instead of *.cpp Myself, I like Microsoft compilers better because they have better debugging tools. You can still get VC++ 2005 Express for …

Member Avatar for server_crash
0
534
Member Avatar for fraley118
Member Avatar for fraley118
0
85
Member Avatar for YoTaMiX

because the keyboard buffer still contains the <Enter> key -- you need to flush that out. One way is like below, which will remove up to 3 keys. [code] char inbuf[4]; menu(); fgets(inbuf,sizeof(inbuf),stdin); //scanf("%c",&choise); choise = inbuf[0]; [/code]

Member Avatar for Ancient Dragon
0
78
Member Avatar for achala

#include<iostream.h> #include<string.h> #include<fstream.h> You must be using an ancient c++ compiler -- maybe Turbo C++? If you want to learn c++ language you will have to toss that compiler into the bit bucket and get a modern one --[URL="www.bloodshed.net"] Dev-C++[/URL] is a good one.

Member Avatar for achala
0
85
Member Avatar for ASH168

what's the difference between [b]deep[/b] copy and [b]shallow[/b] copy or [b]not so deep[/b] copy :rolleyes:

Member Avatar for Narue
0
150
Member Avatar for huffstat

Problem 1: [URL="http://msdn2.microsoft.com/en-us/library/3y1sfaz2.aspx"]__declspec (dllexport)[/URL] is only used in the dll to identify those functions or c++ classes that need to be visible to the outside world (i.e. application program or other dlls.). use __declspec (dllimport) in the function prototype in application programs. [code] int __declspec (dllimport) foo(); // function prototype …

Member Avatar for Ancient Dragon
0
216
Member Avatar for honeybleak

[code] #include <stdio.h> int x; int y; int a,b,c; int main() { // put your code here return 0; } [/code]

Member Avatar for soxers12
0
471
Member Avatar for mohit_mar

There are probably a number of ways to solve that. The solution I took was to create another listener thread. The main program thread sends a message to this listerner thread every keyboard and mouse event. The listner thread waiks up from Sleep() every minute and checks its input queue. …

Member Avatar for Salem
0
286
Member Avatar for Cool Nanu

that is NOT a c++ program. Its a C program. What are the errors? Post them. And you really really need to develop a decent program coding style. Starting everything at the beginning of the line is just plain lazy and horrible. Nobody is going to read that stuff.

Member Avatar for Cool Nanu
0
214
Member Avatar for Te'DDy

[QUOTE=Te'DDy]in here the words j appear second time again in my words series and o also. may be it might be better to check not to repeat the words.So how can i do?[/quote] check the array to see if the char is already in it. If not, add it to …

Member Avatar for iamthwee
0
327
Member Avatar for jasda2

the unsigned char data type has a range of 0 to (and including) 255. So all you need is an int array of that size to count the number of occurences of all characters. Initialize the array to all 0s then use the char itself as the index into the …

Member Avatar for Dave Sinkula
0
189
Member Avatar for Tiffiney_v24

[QUOTE=Cool Nanu]Yes i think thats correct but to help someone is not wrong[/QUOTE] True -- but the OP didn't ask for our help, just stated a problem.:rolleyes:

Member Avatar for Ancient Dragon
0
234
Member Avatar for bigjoke

you can find the exact example of that in Microsoft Scribble tutorial. See [url]www.mscn.microsoft[/url] and search for "Scribble Tutorial". It will show how to just draw straight lines but might be expanded to include other shapes too.

Member Avatar for bigjoke
0
121
Member Avatar for Pacer
Member Avatar for amarie

[code] for ( i = 0; i < n; ++i ) { for ( j = i; j < n; ++j ) [/code] that is a waste of cpu cycles because it compares the first array element with itself. array[i] is the same as array[j] [code] for ( i = …

Member Avatar for Ancient Dragon
0
175
Member Avatar for schmintan

neither -- If you want to learn C then write console programs for the PC because PDA and Palm do not support the full set of C language. And because PC programs are a whole lot easier to debug.

Member Avatar for Salem
0
177
Member Avatar for janito2008

you missed the point. Create only ONE structure that contains the weather data. Then instantiate an array of 12 of these structures. [code] struct weather { int rainfall; int high_temp; int low_temp; }; weather array[12]; [/code] In the above, array[0] = January, array[1] = February ... array[11] = December. In …

Member Avatar for Bench
0
509
Member Avatar for ontrix

you probably need to set the baud rate, stop bits, data bits, and parity. See MSDN about [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/communications_resource_configuration.asp"]how to configure the port[/URL].

Member Avatar for Ancient Dragon
0
116
Member Avatar for ghadahelal

Assuming MS-Windows os, use [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_setlocale.2c_._wsetlocale.asp"]SetLocal[/URL] and the os will make the conversion for you when the values are read from the file.

Member Avatar for Ancient Dragon
0
123
Member Avatar for nguyen duy khoi

you need to know a bit about [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_mixed.2d.language_programming.3a_.overview.asp"]mixed language programming[/URL] and C calling conventions.

Member Avatar for Ancient Dragon
0
125
Member Avatar for puppy

>>If I want to generate random numbers between -1 and 1 Why? The only number between -1 and 1 is 0. -1, 0 and 1 are all integers, there are no fractions in integer math. rand() returns an integer. So if you want a float return value, such as 0.123 …

Member Avatar for puppy
0
178
Member Avatar for ernie

iostream.h is obsolete. Use <iostream> (without .h extension). The iostream class was changed somewhat. If you are using an ancient compiler that does not have <iostream> then you should upgrade to a newer compiler. Any attenpt to use iostreams with ancient compilers will teach you nothing at all about modern …

Member Avatar for ernie
0
268
Member Avatar for Forsal

[QUOTE=Forsal]Hi everybody Can you please explain me the weakpoints of c++ language?[/quote] there are none. The language will allow you to do anything you want to your computer -- even burn it up if you want it to. [QUOTE=Forsal]I think it is very difficult to create GUI in C++, isn't …

Member Avatar for Ancient Dragon
0
236
Member Avatar for behrk2

If you are writng a C program, use fgets() to get the string from the keyboard because it will not permit buffer overflow. Your version of the function has the same problem as gets() -- it will just scribble all over memory when you enter more characters than can be …

Member Avatar for Narue
1
243

The End.