|
The streamin method should work after DDX_CONTROL
I have to have a closer look at my Code
at this point I am thinking that I dont have to Call UpdateData as that is
Done automatically by the default CDialog::Oninitdialog
Which I have in my OnInitdialog
I'll take a closer look
thankx
|
|
|
|
|
I need to get OS info,
1. name: i.e. Windows XP, WinNT 4 etc.
2. edition: i.e. Server, professional, standard etc.
The info should start from Win98 (or Win2K) and up to latest one.
- is the latest one Windows 7 now?
I have C code to show up to XP, do you have code for new OS?
|
|
|
|
|
Use the GetVersionEx[^] API to get the version of the running OS.
Look into the remarks section of the documentation for OSVERSIONINFOEX[^] for the list of OS codes.
|
|
|
|
|
Hi all,
I have a problem in implementing tree traversal using c++, i want to display the output of tree traversal: inorder, preorder, postorder in tree form, this means i should include some graphic codes so as to display the tree format on the screen. I don't have idea how to use graphics to display the output on the screen.
Please help me
|
|
|
|
|
See here.
I've also seen implementations where the tree was laying on its side. It's a recursive approach.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
First you need to learn how to draw lines on the screen. If you're using MFC, look at OnDraw and the CDC class. Then you can look at writing text if you need to do that.
For arranging the binary tree on the screen, a good approach is to space the leaf nodes out evenly horizontally. Then each parent node goes halfway between its sons, on the row above.
|
|
|
|
|
Hi guys ,
I've problem with C in Linux, and just i need to pass args to execvp(args[0],args) to the main function and after creating child process and the code is :
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <unistd.h>
#define MAX_LINE 80
void setup(char inputBuffer[],char *args[],int *background)
{
int i;
int cmd=0;
int l;
scanf("%s",inputBuffer);
if("%d",strlen(inputBuffer)>80)
{
printf("error the maximum size is 80\n");
exit(-1);
}
else
{
args = &inputBuffer;
}
}
int main(void)
{
char inputBuffer[MAX_LINE];
int background =0;
char *args[MAX_LINE/2+1];
char *command;
while(1)
{
background=0;
printf("Command ->");
setup(inputBuffer,args,&background);
pid_t pChild;
pChild = fork();
if(pChild <0){
printf("Error\n");
exit(-1);
}
if(pChild==0)
{
execvp(args[0],args);
}
else {
if(background=1);
wait(NULL);
printf("Child process completed\n");
}
exit(0);
}
}
|
|
|
|
|
So what's the problem?
dr.nokia wrote: if("%d",strlen(inputBuffer)>80)
What's this?
dr.nokia wrote: if(removed=1);
Your compiler should at least be warning you about this, if not outright complaining.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Im trying to update the args to pass into main function to (execvp) and run the command for example
ls - 1
or sh> cat pro.c
just i need to pass args to the main function to execute the command 
|
|
|
|
|
dr.nokia wrote: just i need to pass args to the main function...
Then you're gonna need to change its signature to:
main( int argc, char *argv[] )
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
ok! i changed the signature but the output only "Child process completed")

|
|
|
|
|
by the way : if(removed =1) it's if (background=1)
|
|
|
|
|
Until you have a firmer grasp of functions, pointers, arrays, etc, you'd be better served by simplifying your code down to something like:
void main( void )
{
execvp("ls", "- 1");
printf("Child process completed\n");
} Once you get that working, then you can start using scanf() to replace the string literals.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
The statement args = &inputBuffer; in the setup() function, does not change the args variable in main() . Also you have not split the input buffer into its separate components. I would spend some time parsing your input to ensure it's in the correct format before worrying about using the fork() and execvp() functions.
|
|
|
|
|
I did that it works fine but like execvp("ls",args);
not like your code execvp("ls","-1");
it's work perfect and execute the all ls command
but it's possible to put any command I prefer? for example ps -el or any another shell command for Linux O.S?

|
|
|
|
|
dr.nokia wrote: not like your code execvp("ls","-1");
I didn't post any code
dr.nokia wrote: but it's possible to put any command I prefer?
It's some while since I did this, or used Linux, but in theory I think you can put any command into the exec() functions. The key as always is getting your parameters organised correctly according to the version of the exec() call that you are making.
As I said before, I think the important thing is to get comfortable with parsing strings and using function calls and their parameters correctly. Once you have your head round those concepts then the second half is easy.
|
|
|
|
|
you mean to check my command then invoke it to execvp() ?
|
|
|
|
|
dr.nokia wrote: you mean to check my command then invoke it to execvp() ?
Well I'm not exactly sure what your level of expertise is, so I was really trying to suggest that you get comfortable with the simple things before moving to the more complex ones. The same as any learning process really.
|
|
|
|
|
Really I wana be very good in programming if you have explanation about this and signals also and sources please get it to me 
|
|
|
|
|
Actually I need to very clear in C then coz im studying computer science then and im taking OOP and then I will teach my self C# and more advanced programming courses.
By the way the industry for programming what the most wanted programming languages in this days?
|
|
|
|
|
dr.nokia wrote: Really I wana be very good in programming.
First you need ability, which some have in greater measure than others.
Second you need to study and work hard, in whatever environment and language you choose, whether it is ASP.NET, .NET, or plain Win32 using VB.NET, C#, C++, Java etc.
Third there is no such word in English as "wana" or indeed "wanna".
dr.nokia wrote: By the way the industry for programming what the most wanted programming languages in this days?
No idea, look in the trade journals in your country to see what is most in demand.
|
|
|
|
|
dr.nokia wrote: Really I wana be very good in programming
So do All of us.
The key is to start at the beginning, preferably with something simple, e.g.: Work with an example provided by others, Read Books,etc. until you have a basic grasp of the concepts involved. I think what you are trying at the moment is still out of your reach, given the level of knowledge you demonstrate.
Bram van Kampen
|
|
|
|
|
Hi All,
I have an application in which i am taking an LOGINREC structure variable like this LOGINREC m_loginrec which is defined in syblogin.h of SYBASE SDK 11.1.1
and my code is like this
if ((m_loginrec = dblogin()) == 0)
{
TRACE0("dbl: couldn't get loginrec.\n");
return FALSE;
}
// Set the login timeout value.
dbsetlogintime(m_login_time);
// Set up the loginrec.
if (m_application.GetLength() > 0)
DBSETLAPP(m_loginrec, (char *) (const char *) m_application);
if (m_user.GetLength() > 0)
DBSETLUSER(m_loginrec, (char *) (const char *) m_user);
if (m_password.GetLength() > 0)
DBSETLPWD(m_loginrec, (char *) (const char *) m_password);
if (m_host.GetLength() > 0)
DBSETLHOST(m_loginrec, (char *) (const char *) m_host);
// Open the connection.
if ((m_dbproc = dbopen(m_loginrec, (char *) (const char *)m_server)) == 0)
{
TRACE1("dbl: couldn't open connection to server %s.\n",
(char *) (const char *) m_server);
return(FALSE);
}
The problem of mine is
As i will get LOGINREC pointer through dblogin() function,that pointer i am passing through dbopen() function.My code is perfectly working in vs-2003 in MS-2000 machine...
But when i migrate the code it is returning the proper LOGINREC when i enter correct login and password otherwise The entire application is getting crashed when i enter wrong username/password...
Can i change or define my own LOGINREC (or) It is with problem of VISTA machine...?
Can anybody suggest...?
Thanks in Advance
|
|
|
|
|
If the problem is occurring only in Vista, it could be a permission issue.
Try the same exercise with UAC turned off.
Also, try it with an Administrator and Non-Administrator account.
|
|
|
|
|
Hi thank you for reply...
Actually we are using SYBASE SDK11.1.1 in MS-2000....But In Vista OS,Microsoft has come with SDK 12.5.1
Can you please tell am i getting this problem because of the SDK?
Should i install the same SDK into my Vista Machine??
Please Suggest..
And please tell me how to turn off UAC
|
|
|
|