15,300 Posted Topics

Member Avatar for NoNameHere

The code you posted requires the program to read just 3 lines of text. What happens if there is only 1 line, or 20 lines, or 1,000 lines? You certainly don't want to have to count the number of lines before reading the file. A solution is to 1. Create …

Member Avatar for Ancient Dragon
0
75
Member Avatar for shantanusinghal

>>strcpy(address,NULL); strcpy() hates that statement because it expects a valid pointer as the second argument, not NULL pointer. If all you want to do is initialize the array to 0 then use memset(), e.g. [icode]memset(address,0,sizeof(address));[/icode], assuming that address is not a pointer. Or you can just simply do this: [icode]address[0] …

Member Avatar for shantanusinghal
0
289
Member Avatar for ktsangop

I think pipes will work for you. [URL="http://www.google.com/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS397&q=popen+and+mfc&aq=f&aqi=&aql=&oq="]Here[/URL] are a few links you might want to read.

Member Avatar for ktsangop
0
436
Member Avatar for Ancient Dragon
Member Avatar for samhitha.44

Whether you can find it with google or not will depend on the problem you want to solve. The source code for most programs are [URL="http://en.wikipedia.org/wiki/Proprietary_software"]proprietary [/URL]and are not posted anywhere on the internet.

Member Avatar for jnawrocki
-1
269
Member Avatar for chintan_1671

Not all DLLs have to be registered. Just because it uses COM doesn't mean it has to be registered. Just put it in one of the folders in the PATH environment variable.

Member Avatar for chintan_1671
0
268
Member Avatar for Ancient Dragon

I get this error for every thread I click in the c++ forum. C forum seems to be ok.

Member Avatar for Dani
0
39
Member Avatar for BMW87

What are the errors and warnings?? We can't read your mind or see your computer, so you have to be specific and tell us.

Member Avatar for BMW87
0
338
Member Avatar for cheers07

What operating system and what compiler ? The easiest way to capture the Enter key would be to use the non-standard functions in conio.h, but your compiler may or may not support that.

Member Avatar for cheers07
0
250
Member Avatar for sahil1991
Member Avatar for Ancient Dragon
0
127
Member Avatar for ODs

GUI and RS232 serial port program are unrelated. Here is a list of the [URL="http://msdn.microsoft.com/en-us/library/aa363194(v=vs.85).aspx"]Windows Communications Functions[/URL]. Start out by calling CreateFile() to open the serial port, then BuildCommDCB() to set up the port configuration (stop bits, data bits, parity, etc). Then ReadFile() to read from the port and WriteFile() …

Member Avatar for Ancient Dragon
0
435
Member Avatar for MichaelSammels

>>And it outputs junk (mainly numbers like -147, 70, 8, 10), etc. Exactly -- binary files can not always be read, which is why they are called binary files. You have to know how the binary file is formatted before you can make any sense out of them. For example, …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for winecoding

The problem is that p will be pointing to some out-of-range memory location and that has nothing at all to do with whether its of type T or not. You will get the same error if you try to do the same thing in a simple C program. C and …

Member Avatar for Ancient Dragon
0
80
Member Avatar for abrocker

Any salary difference will be neglible. You need to talk to a school couseler at the college you want to attend to find out what courses are required for each of those degrees. A degree in CS will probably require more math than the degree in IT.

Member Avatar for pseudorandom21
0
234
Member Avatar for Michael_Knight

Stormy Norman [quote="Norman Schwarzkopf"]It doesn't take a hero to order men into battle. It takes a hero to be one of those men who goes into battle. [/quote] [quote="Norman Schwarzkopf"]He <Saddam Hussein> is neither a strategist nor is he schooled in the operational arts, nor is he a tactician, nor …

Member Avatar for happygeek
0
1K
Member Avatar for zehraIOI

SqLite doesn't throw exceptions, it just returns errors. You will have to change SqLite source code to make it throw exceptions like what you want. You have all the source code so you can change it any way you like.

Member Avatar for sheennave
0
130
Member Avatar for Spiffy P Mcgee

Yes they should return an int, but the author probably omitted that just to simplify the code and illustrate the intended problem.

Member Avatar for Ancient Dragon
0
128
Member Avatar for txwooley

You could try [URL="http://lmgtfy.com/?q=c%2B%2B+color+codes"]this[/URL] or [URL="http://lmgtfy.com/?q=c%2B%2B+color+text"]this[/URL] to get examples

Member Avatar for txwooley
0
120
Member Avatar for tehmarto

have you tried [URL="http://msdn.microsoft.com/en-us/library/3e22ty2t(v=vs.80).aspx"]SetLocale()[/URL]

Member Avatar for tehmarto
0
421
Member Avatar for amol0712

[URL="http://lmgtfy.com/?q=duplex+communication+using+c"]Did you try this[/URL]?

Member Avatar for Ancient Dragon
0
39
Member Avatar for muze

CString has a Format() method that works exactly like sprintf(). Simplify your code like this: [icode] CString m_strFileName.Format("%02d/%02d/%4d %02d:%02d:%02d", t.wDay,t.wMon,t.wYear, t.wHour,t.wMinute,t.wSecond); [/icode] Adding 5 to t.wHour can easily make t.wHour exceed 60.

Member Avatar for Ancient Dragon
0
449
Member Avatar for user543820

don't use strtok() because it will put 0s in the std::string buffer, invalidating that buffer. Instead, use std::string's find() method to locate the spaces, the substr() to extract the characters.

Member Avatar for Ancient Dragon
0
174
Member Avatar for fuller

functions and structure in time.h will give you that information. [list=1] First put the day, month and year in a struct tm structure. Then call mktime() to populate the rest of the structure. tm_wday contains the day of the week.

Member Avatar for jnawrocki
0
109
Member Avatar for kukuruku

>>but it doesnt work What does that mean??? lines 13 and 14 could be both replaced by one line: jl end_if

Member Avatar for Ancient Dragon
0
315
Member Avatar for virtue

depends on the functions you are using to get the files in a folder. On MS-Windws using FindFirstFile() and FindNextFile(), see the fields in the [URL="http://msdn.microsoft.com/en-us/library/aa365740(v=vs.85).aspx"]WIN32_FIND_DATA[/URL] structure. dwFileAttributes will tell you whether its a file or a folder. Similar on *nix using opendir() and readdir() functions.

Member Avatar for Ancient Dragon
0
174
Member Avatar for francisp94

The while statement on line 19 is incorrect -- you don't need numOfInput. To read the entire file the while statement should be constructed like this: [icode] while( inStream>>deweyDecimal ) { // blabla } [/icode] But that will only read one word. If each line in the file contains more …

Member Avatar for francisp94
0
137
Member Avatar for vjackcon

You can use [URL="http://www.codeblocks.org/downloads"]Code::Blocks[/URL] on both MS-Windows and *nix

Member Avatar for Ancient Dragon
0
115
Member Avatar for margeaux54

>>while (a!='q' || a!='Q') Use && operator instead of ||. Read it as "while a not equal to 'q' and not equal to 'Q'" >>expected before "return" I think you will need a semicolon at the end of that line too because its the end of a do loop

Member Avatar for Ancient Dragon
0
123
Member Avatar for Ancient Dragon

go to c++ forum and look at the last date and reaction columns. They are just wrong. For example the thread "Different Heaps" shows last date was 37 minutes ago and Reaction shows 1 post. Now click on that thread and look at the time of the last post -- …

Member Avatar for Nick Evan
0
171
Member Avatar for winecoding

text is a pointer to a character arrray. The star in front indicates dereference of the character. So if text == "Hello", then *text is looking at the first letter, 'H'. C strings are always terminated with the NULL character 0, or '\0'. The while statement as written is poorly …

Member Avatar for Ancient Dragon
0
110
Member Avatar for rjbrjb777

Just call fgets() to read the first line before starting the loop on line 32. I think this would be a lot easier if you used fgets() to read every line, then parse it by using strtok() [code] char buf[255]; fgets(buf, sizeof(buf), in); // just ignore the first line while( …

Member Avatar for rjbrjb777
0
2K
Member Avatar for rjbrjb777
Re: GUI

Depends. What operating system? For MS-Windows, do you want to use pure win32 api functions? If yes, [URL="http://winprog.org/tutorial/"]here is a tutorial[/URL]. But there are a lot easier ways to write gui programs nowdays. Two of them is CLR/C++ Windows Forms, and C# instead of C. If you are thinking *nix, …

Member Avatar for rjbrjb777
0
96
Member Avatar for jay_el_em

>>Am I too old to do some courses and become a programmer??? Not unless you are over 100 years old :) I didn't start programming career until I was in my early 40s.

Member Avatar for JamieLynnSEO
0
246
Member Avatar for vegaseat
Member Avatar for Dundir

>>if( (ch-48) >= 0 && (ch-48) <= 9) replace that with: [icode]if( isdigit(ch) )[/icode]

Member Avatar for Ancient Dragon
0
170
Member Avatar for NicAx64

>>Update: The professor in question has been reported and is now banned from taking any more classes. hallelujah! :)

Member Avatar for Momerath
0
251
Member Avatar for abcdabid

>>strTemp.Format(_T("item"), i + 1); Format() function is very similar to sprintf() -- you need to add %d if you want the string to contain the value of i+1.[icode]strTemp.Format(_T("item %d"), i + 1);[/icode]

Member Avatar for abcdabid
0
344
Member Avatar for eline83

To complicate it a little more, the main program and DLL each have their own heaps (and memory managers), and that's why memory allocated in a DLL can not be released in the main program (or another DLL) and vice versa. I'm not sure if shared libraries on *nix work …

Member Avatar for Ancient Dragon
0
110
Member Avatar for Sibuns

That's not possible. Why? One reason is that getline() doesn't know, or care, what the size of the command window is. It reads everything up to the '\n', or some other character you specify.

Member Avatar for HASHMI007
0
96
Member Avatar for margeaux54

>>if ( 'a'=!'e' || 'a'=!'d' || 'a'=!'E' || 'a'=!'D') remove the quotes around variable a [icode]if ( a=!'e' || a=!'d' || a=!'E' || a=!'D')[/icode] and not equal is != You want to use && and operator, not or operator. Using or in that statement will cause it to always return …

Member Avatar for margeaux54
0
150
Member Avatar for shantanusinghal

>>operand[i]!='+' || operand[i]!='-'; Use && operator instead of ||. Read the statement aloud to yourself -- "do while operand not + and while operand not -.

Member Avatar for Ancient Dragon
0
104
Member Avatar for winecoding

lines 14 and 17 are just showing you two different ways to do the exact same thing.

Member Avatar for Ancient Dragon
0
74
Member Avatar for ChristinaS

>>1- read files from the directory, avoiding sub-directories (along w/ _chdir) That means to use directory functions to get the names of all the files in a directory. How to do that will depend on what operating system you are using. [list=1] [*]MS-Windows: FindFirstFile() and FindNextFile() [*]*nix: Opendir() and ReadDir() …

Member Avatar for WolfPack
0
458
Member Avatar for determine

>>You have to include windows.h, No you don't. including windows.h will make a simple console program carray around a lot of useless and unnecessary bagage. Just include cstdlib (as previously mentioned) or stdlib.h.

Member Avatar for determine
0
4K
Member Avatar for cableguy31

You don't need that loop at all -- just set up al, eax then call [icode]rep scasb[/icode] to search for the string length

Member Avatar for untio
0
3K
Member Avatar for VanHackman
Member Avatar for lochnessmonster
Member Avatar for shantanusinghal

try using [icode]if( inHandle.is_open() )[/icode] The problem might also be that the file does not exist in the current working directory.

Member Avatar for Narue
0
641
Member Avatar for jasoncastro

Your program seems to be doing it correctly. But I don't see where you declared variable named sum.

Member Avatar for jasoncastro
0
345
Member Avatar for LexLieberthal

>>My friend needs a program that will: That's nice -- now when are you going to write it for him? We certainly will not without a lot of $$$$.

Member Avatar for LexLieberthal
-1
147

The End.