|
thank mike pallini and star08 already suggest me pointers for C so i used them
|
|
|
|
|
You can't return a struct in C ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Actually, quite simple. Declare a Structure:
<br />
struct RESULT {double Res1,Res2};<br />
and let your function return this structure
LateNightsInNewry
|
|
|
|
|
|
Hey guys, my first post here =)
Anyways, I'm trying to use EndTask to close a Window, but unfortunately it doesn't work. I get an error 'EndTask' : undeclared identifier. I looked on MSDN http://msdn2.microsoft.com/en-us/library/ms633492.aspx and every thing appeared good, this is the code I'm using: HWND hWin;
hWin = FindWindow(NULL,"Application");
EndTask(
hWin,
FALSE,
TRUE
);
Hope you guys can help me out, thanks
|
|
|
|
|
I suggest to you to pay attention to the Remarks section of the page you referenced and hence to use other functions, see here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks or the reply, I really want to use the EndTask function, the only one that will work in my case, and I looked in the remark section, and I think this is what you were talking about "accessible using the appropriate Include file and library linkage" well I included windows.h and imported the User32.lib. I'm really lost right now. But thanks for the reply and if you could help again it would be great!
|
|
|
|
|
Have you made an attempt to link the DLL explicitely, i.e. via LoadLibrary and GetProcAddress ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hello,
Through the program I want to access different tree items, what is the pointer or how can I declare a pointer to access these items in the tree?
Thank you.
--Star
|
|
|
|
|
Star08 wrote: what is the pointer or how can I declare a pointer to access these items in the tree?
How did you create the tree?
led mike
|
|
|
|
|
linklist, but I'm trying to display it using Tree Control.
So far, I can display the root and its children. But when I try to post the grandchildren, they are posted as the root's children.
--Star
-- modified at 16:27 Saturday 19th May, 2007
|
|
|
|
|
Items in a treeview control are identified by a handle (HTREEITEM type).
You can navigate the tree (item handle) heirarchy with TVM_GETNEXTITEM. You can get an items
information with TVM_GETITEM.
Instead of a pointer to an item, you'll probably want to work with a HTREEITEM handle.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thank you
--Star
|
|
|
|
|
I'm an odd newbie: I need to compile unmanaged c++ code in VS2005. I've only compiled managed c# in VS'03/'05. What switches do I need to set, and do I need to also do something with the linker.
Thx.
|
|
|
|
|
Just create a C++ Window Application Project.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
You don't need to do anything, the default for the C++ compiler is native.
|
|
|
|
|
#include < stdio.h>
#define N 10
#include < stdlib.h>
#include < math.h>
void insert_array ( long p[] , int nCount , long a ,long b);
double find_values( long p[] ,int nCount );
void print_array1( long p[] , int nCount);
void print_array2( long p[][2] , int fCount);
int main()
{
long n[N];
insert_array( n[ N ] ,N , 1 , 5);
return 0;
}
void insert_array (long p[] , int nCount , int a ,int b)
{
for ( int i = 0 ; i < nCount ; i++)
{
p[i] = a + (rand()%(b-1));
}
}
when i try to compile i have this error :
error C2664: 'insert_array' : cannot convert parameter 1 from 'long' to 'long []'
|
|
|
|
|
found my fault :P n[N] != array :/ its a number i had to use n
|
|
|
|
|
Hi
(Didnt find any discussion board plainly for C++. Found this the closest to send a message on.)
Im writing a code in C++ that reads a text file which is a list of words in the english language. The delimiter i use is a line feed. Being a dictionary, the text file is huge.The compiler i use is TURBO C
My code is to enter a substring from a user and its position(if its prevocalic, post vocalic or inter vocalic) and accordingly feed the words with the substring into an output file.My code works perfect with a small text input file.. i.e a dictioary with a very few entries. How do i make it work for a large size??
Pl help!!
|
|
|
|
|
So what's the problem? Shall I try to guess?
Reading small files is just like reading big files. Or is your dictionary file too big for the whole thing to fit into memory?
Lets say a dictionary has (at a guess) 100000 words. At an average of 10 characters, that's one meg. No problem. Even if you allocate a fixed array to store the words, each element will have to be the length of the longest word, which is ?what? (another guess) 50 characters. So you need 5 Meg of memory to store 100000 words, with a maximum length of 50 characters. Still no problem.
Maybe the problem is to do with your search algorithm.
I'd guess that prevocalic (if that means "the substring is at the start of the word) is straight-forward.
For post vocalic (if that means "the substring is at the end of the word) you might want to have a second copy of your list sorted alphabetically from right-to-left.
I have no idea how you'd search for inter vocalic (if that means "the substring is anywhere in the word.) I guess brute-force and pig-ignorance should do it, but it will be slow!
Did anything here help define your problem better?
|
|
|
|
|
I am trying to make a long number to double ( or that isn't possible? )
compiler throw me 2 errors on s variable (illegal , left operant has type 'double' )
What am I do wrong ? :/ as usually
my code :
double find_values( long p[] ,int nCount )
{
double mid ;
double s ;
for ( int i =0 ; i < nCount ; i++ )
{
mid = mid + p[i];
}
mid = mid/nCount;
for (int z = 0 ; z < nCount ; z++)
{
s = (double) (s + (p[z] - mid)^2);
}
s = (s/(nCount -1))^(1/2);
return (mid,s);
}
|
|
|
|
|
I think even writing double is also not necessary ,compiler will do it for you. error may be due to some different reason.
|| ART OF LIVING ||
|
|
|
|
|
oh yes :/ the error is '^' : illegal, left operand has type 'double'
so its illegal to make power ? ^
|
|
|
|
|
^ is not the raise-to-power operator. Use pow() and sqrt() instead.
|
|
|
|
|
yes thanks i just include math.h and used pow()
|
|
|
|