15,300 Posted Topics

Member Avatar for therobot

Post the section of code that is used to write to the Component2-obs.txt. The code you posted does not tell us enough information to answer your question.

Member Avatar for therobot
0
140
Member Avatar for tehb

Yes you can mix both C and CPP files in the same project. C functions can not generally call c++ functions, but c++ functins can call C functions. You just have to tell the compiler which c functions you want to call from the c++ functions. This is how you …

Member Avatar for tehb
0
276
Member Avatar for shears

There is tons of information available via google [URL="odbc tutorials"]odbc tutorials[/URL] [URL="http://www.google.com/#hl=en&q=odbc+c%2B%2B+wrapper&aq=4&aqi=g6&aql=&oq=odbc+c%2B%2B+&gs_rfai=&fp=b4a8ee3a24fac13f"]odbc c++ libraries[/URL] [URL="http://www.sqlapi.com/"]SQLAPI++[/URL] [URL="http://www.sqlite.org/"]SqLite[/URL]

Member Avatar for Ancient Dragon
0
125
Member Avatar for george61

the loop should be something like this. And do not dynamically allocate array a because it is causing you a memory leak (your program doesn't delete[] it). The array size is small enough that dynamic allocation isn't necessary anyway on most modern operating systems such as MS-Windows and *nix. [code] …

Member Avatar for george61
0
107
Member Avatar for heena sharma

One way to do it is to copy the string backwards into another character array.

Member Avatar for Fbody
0
132
Member Avatar for Ancient Dragon
Member Avatar for IT cllge stdnt
2
152
Member Avatar for 060609
Member Avatar for evinkeating

[code] /* initialise triangular matrix to zero */ for(i =0; i < dimention; ++i) for(j =0; j <= i+1; ++j) lower_tri[i][j] = 0; [/code] The above causes buffer overrun. The inner loop should be < not <=

Member Avatar for evinkeating
0
891
Member Avatar for evinkeating

the array has to be deallocated in the reverse order that it was allocated [code] for(i =0; i < dimention; ++i) free(lower_tri[i]); free(lower_tri); [/code] If you get seg fault with that then it means the program has been corrupted somewhere.

Member Avatar for Ancient Dragon
0
209
Member Avatar for integer*09

You need to force Form to repaint itself before each Sleep(). I'm not sure how to do that (I don't normall write CLR code) but [URL="http://social.msdn.microsoft.com/Forums/en-US/winformsdesigner/thread/6b22a6b4-0773-48f9-825d-47f80bc15c42"]here is a start[/URL].

Member Avatar for integer*09
0
103
Member Avatar for molocas

If you are using VC++ 2010 (or 2008) you can create CLR Forms application in which you can easily create text boxes to display the information from the file. google for clr tutorials and you will find out how to do that. I though you said the program reads the …

Member Avatar for Ancient Dragon
0
175
Member Avatar for yan_yan
Member Avatar for bleedi

All you need is three very simple if statements, something like below if string length != 2 then error if string[0] < 'A' || string[0] > 'F' then error if string]1] < '1' || string[1] > '4' then error

Member Avatar for Ancient Dragon
0
136
Member Avatar for KV305

Your compar function is wrong. qsort() sends two pointers to the compare function [icode]int compare(const void* s1, const void* s2)[/icode] In your case it will send two strings, so your compare function needs to typecase the void* to char* [code] int compare(const void*s1, const void* s2) { return strcmp((const char …

Member Avatar for Adak
0
120
Member Avatar for Luther von Wulf

One common c++ exercise is: Write a recursive function that gathers a list of all the files and folders on the hard drive, starting with a folder specified by the user. You will need to maintain either a std::vector or std::list (your choice) of all the files, and the file …

Member Avatar for mrnutty
-1
2K
Member Avatar for kfernandez

line 11: initialize the variable to be 0, not 1. All arrays start counting at 0. line 13: you can initialize that array to be all 0s when it is declared, elmininating the need for the loop on lines 22-25. [icode]int asciichar [223] = {0};[/icode] line 31: A for loop …

Member Avatar for kfernandez
0
71
Member Avatar for boos800

>>I keep getting an 'argument not declared in scope' error, even though his works perfectly Talk about a contridction of terms! You get compile errors but yet you claim it works perfectly :icon_eek: Solve the problem in one of two ways: [icode]cop3530::hash_table<int, int, cop3530::linear_probe> ht(10); [/icode] or adding this at …

Member Avatar for mrnutty
0
274
Member Avatar for Jacobah

Everything in MFC is handled via events -- messages that are passed through the event handler ([URL="http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/b44f06fb-fc4a-4fac-87cd-48b2953ea5fa"]Windows Message Pump[/URL])located in an MFC function that is called from main(). OnStnClicked() will not be called until program control returns back to that message pump. When OnStnClicked() returns, program control is returned back …

Member Avatar for Jacobah
0
190
Member Avatar for johnnyturbo3

I use inline functions frequently in header files but they are really only useful for functions that are only one or two lines. If you do this for functions on in a c++ class then you must declare them with the inline keyword (or __inline depending on the compiler). If …

Member Avatar for mike_2000_17
0
7K
Member Avatar for Hand
Member Avatar for renar

look for qsort() -- all you have to do is write your own custom comparison function that returns an integer similar to strcmp(). The code below assums you are sorting an int array in descending order. [code] int mycomp(const void* p1, const void* p2) { int* i1 = (int*)p1; int* …

Member Avatar for Ancient Dragon
0
261
Member Avatar for crapgarden
Member Avatar for crapgarden
0
147
Member Avatar for madzam

Move lines 27 and 28 inside the while loop so that it asks for a temperature on every iteration of the loop. Delete the if statement on lines 30 and 31 because the program already knows how many temps to enter. The while statement on lines 40 and 41 is …

Member Avatar for Andreas5
0
162
Member Avatar for danswater

Conversion is not necessary. The char data type is a one-byte integer. [code] char x = 2; int y = x; [/code] The compiler will promote the char to int during the assignment.

Member Avatar for rax_19
0
115
Member Avatar for SHENGTON

Where in the world did you get that binary seach algorithm??? It isn't nearly that hard. [code] void bsearch(int a[], int size) { int n = 0; int high,low,mid,count; printf("Enter number to be searched\n"); scanf("%d", &n); getchar(); high = size; low = 0; count = 0; do { mid = …

Member Avatar for Adak
0
135
Member Avatar for aaronmk2
Member Avatar for mrnutty
0
97
Member Avatar for sabareesh

why are you calling malloc() is a c++ program? Change it to new and see if that fixes the error. If not, then the real problem is in parts of the program that you did not post.

Member Avatar for Ancient Dragon
0
133
Member Avatar for Rickay

>>if(output == "file.txt") You can not compare two character arrays like that. You have to use strcmp() [icode]if( strcmp(output, "file.txt") == 0) [/icode] >>if(b == "file.txt") That is trying to compare a single character with a character array. And the line above it is asking you to enter a string …

Member Avatar for Ancient Dragon
0
145
Member Avatar for ellainian

Search [url]www.codeproject.com[/url] -- they have thousands of free MFC classes. If you write MFC then you need to bookmark that site.

Member Avatar for Ancient Dragon
0
30
Member Avatar for jagan605

graphics.h is not supported by any *nix compiler -- it was developed for Turbo C on MS-DOS 6.X and older operating system. So you might as well forget about trying to use graphics.h on *nix or with g++ compiler.

Member Avatar for jagan605
0
317
Member Avatar for everard

See CEdit's [URL="http://msdn.microsoft.com/en-us/library/w9kftda4%28VS.80%29.aspx"]SetSel[/URL] method

Member Avatar for Trepach
0
2K
Member Avatar for Frederick2

>>The 2nd parameter confuses me a bit because its typed as an int which is a 32 bit quantity in 32 bit Windows, yet the example above shows a literal char being used character is just a one-byte signed integer. The compiler will promote it to an integer of the …

Member Avatar for Frederick2
0
643
Member Avatar for merse

The best one is vc++ 2010 Express. Another very good one is Code::Blocks. google for them and you will find download links.

Member Avatar for Ancient Dragon
0
57
Member Avatar for vlad44

If you want to deal with subfolders then you will have to start by passing *.* to FindFirst() so that it will return all files and foldes. Then your program will have to filter out the ones it wants. There have been several code snippets that illustrate how to do …

Member Avatar for Ancient Dragon
0
199
Member Avatar for siriphonic.ner

>> need help solving this. Stuck half way Post what you have done so far. We don't do people's homework.

Member Avatar for siriphonic.ner
0
2K
Member Avatar for Garrett2011
Member Avatar for mike_2000_17
0
208
Member Avatar for Duki

That was three years ago -- the mixture may have changed since then.

Member Avatar for dream party
0
348
Member Avatar for merse

I suppose you didn't [URL="http://www.opengroup.org/onlinepubs/009695399/functions/isinf.html"]google and find this[/URL]

Member Avatar for merse
0
182
Member Avatar for Aigulek

What happens after the third attempt? >>(che = getch()) != EOF EOF is only generated on MS-Windows by pressing Ctrl+Z key combination. How likely is that ever to happen in your program? >>&& i < sizeof(pword) variable i needs to be reset back to 0 before second and third attempts …

Member Avatar for Aigulek
0
107
Member Avatar for pawan_sharma777

>> char *cUser[5] That declares an array of 5 pointers. Are you attempting to store 5 different use names in that array? If you are, then you have to allocate memory for them before they can be used. There are a couple ways to do it 1) use static allocation, …

Member Avatar for Ancient Dragon
0
159
Member Avatar for LevyDee

CDialog is the class name of a generic dialog class. serverDlg is a class that was derived from CDialog. So if m_pDlg was declared like this: [icode]CDialog* m_pDlg;[/icode] then later assigned to a pointer of type serverDlg then the line you are confused about is typecasting m_pDlg from CDialog to …

Member Avatar for LevyDee
0
210
Member Avatar for The Founder

Do you know how to READ? I assum you do since you know how to write (this thead). Read the [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]DaniWeb Rules[/URL], which you should have done when you joined.

Member Avatar for Ezzaral
-5
191
Member Avatar for Lux Fero

turbo c is a 16 bit compiler and can not access win32 api function. So you can't create a windows app with it. Get a modern compiler such as Code::Blocks or VC++ 2010 Express (both are free).

Member Avatar for Lux Fero
0
146
Member Avatar for mrnutty

In think there are two reasons for that 1) their age. 20 years ago people didn't start programming until they were at least yound adults and therefore had better research skills. Many people today start when they are young children, aged about 10 and the only thing they know is …

Member Avatar for mrnutty
-1
107
Member Avatar for sabareesh

LPCTSTR is typedef'ed in windows.h as [icode]const char*[/icode]. So your String class will want to return a char* pointer to its character array, or whatever kind of data it holds. [code] class String { private: char* str; public: const char* operator LPCTSTR() { return str; } }; [/code]

Member Avatar for Ancient Dragon
0
238
Member Avatar for evinkeating

If it works on MS-Windows its just by dump luck >>line 17: lower_tri[i][j] = values[k]; Look at line 4 and tell me how many floats are allocated to each row of lower_tri array. Answer: Row #0 is 1 float, row #1 is 2 floats, row #3 is 3 floats etc. …

Member Avatar for Ancient Dragon
0
185
Member Avatar for coroll

A composite key means the key consists of two or more fields. "select price from item_size where field1 = "something" and field2 = "smethin else" and ..."

Member Avatar for Ancient Dragon
0
104
Member Avatar for adaniel058

Inside the header file you have to tell the compiler that string is in std namespace. Putting [icode]using namespace std;[/icode] in the *.cpp files is not sufficient because that line is located after the header file that contains the Phone class. [code] class Phone { public: void Set(std::string firstName, std::string …

Member Avatar for adaniel058
0
115
Member Avatar for Aia

Oh what sad news. We will surly miss him very much. He was one of the best contributors here at DaniWeb. Thank you for posting to let us know of that very sad event.

Member Avatar for sureronald
9
625
Member Avatar for Anocondo

The first thing you need to do is understand the mathametics. Use pencil & paper and work that out so that you know how to make the calculations.

Member Avatar for mike_2000_17
0
268

The End.