|
|
such a long reply.. happy new year!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
ThatsAlok such a long reply..
Probably ignored: he posted again is question...
ThatsAlok happy new year!
Happy new year, Alok! Best wishes!
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The following program is taking the inputs in the structures but when it comes to print them the program terminates abruptly.
//OBJECT: To make a program to take the input from user as the names of the owner, chassis numbers,
//model, car brand and to store them in structures
#include<stdio.h>
#include<conio.h>
#include<string.h>
struct data{
char oname[20];
int chno;
int model;
char brand[20];
};
main()
{
int slot,i=0;
typedef struct data a;
printf("Enter the no. of data slots you want to make\n");
scanf("%d",&slot);
a c[slot];
for (i=0;i<slot;i++)
{
printf("Enter the Owner's Name\n");
//gets(c[i].oname);
scanf("%s",&c[i].oname[20]);
printf("Enter the chassis number\n");
scanf("%d",&(c[i].chno));
printf("Enter the model year\n");
scanf("%d",&(c[i].model));
printf("Enter the brand name\n");
//gets(c[i].brand);
scanf("%s",&c[i].brand[20]);
}
for (i=0;i<slot;i++)
{
printf("%s %d %d %s\n",c[i].oname[20], c[i].chno,c[i].model,c[i].brand[20]);
}
getche();
}
|
|
|
|
|
Razanust wrote: a c[slot];
This will not work, you cannot allocate an array with an unknown size. I also don't know how you got this to work in the first place is it does not comile (as is to be expected).
|
|
|
|
|
As Richard said, the program shouldn't compile at all.
Also you need to put a fflush(stdin) call after each scanf statement so that the remaining characters in the input stream which cannot be read by scanf are removed.
|
|
|
|
|
Hi,
With reference to Mr Richards reply i made some changes which will make ur program to work. The changes are commented. the slot size should be created dynamically as suggested. Hope u can understand the code. I am beginner too.
Good luck
//OBJECT: To make a program to take the input from user as the names of the owner, chassis numbers,
//model, car brand and to store them in structures
#include<stdio.h>
#include<conio.h>
#include<string.h>
struct data{
char oname[20];
int chno;
int model;
char brand[20];
};
const int slot =2; //changed here as pointed out by Mr Richard
void main()
{
int i=0;
typedef struct data a;
printf("Enter the no. of data slots you want to make\n");
//scanf("%d",&slot); //commented here
a c[slot];
for (i=0;i<slot;i++)
{
printf("Enter the Owner's Name\n");
//gets(c[i].oname);
scanf("%s",c[i].oname); //&c[i].oname[20] not necessary
printf("Enter the chassis number\n");
scanf("%d",&(c[i].chno));
printf("Enter the model year\n");
scanf("%d",&(c[i].model));
printf("Enter the brand name\n");
//gets(c[i].brand);
scanf("%s",c[i].brand); //&c[i].brand[20] not necessary
}
for (i=0;i<slot;i++)
{
printf("%s %d %d %s\n",c[i].oname, c[i].chno,c[i].model,c[i].brand);
}
getche();
}
|
|
|
|
|
I want to know the Brush file format, help me !
My email: dsclub@vip.qq.com
Thank You!
Coding, Learning, Smiling...
|
|
|
|
|
Please help me, I want to do some research, and develop a small tool to view abr file!
Coding, Learning, Smiling...
|
|
|
|
|
I'm trying to code a driver that will read from either virtual or physical memory given an address and report the contents.
Obviously I would vrather read from virtual memory, but at this point I still have a lot to learn about the mysterious kernel lol...
This is where im looking: im going to try and copy the contents of an address into a buffer. The goal is one byte
using:
VOID
RtlCopyMemory(
IN VOID UNALIGNED *Destination,
IN CONST VOID UNALIGNED *Source,
IN SIZE_T Length
);
My first problem is how I am going to pass these parameters to my driver from my GUI.
Secondly, I could benifit from some insight on how this will work.
I am thinking that when my driver calls RtlCopyMemory() its going to get a pointer to a byte to copy, but I was planning on passing a virtual address. In that case i have the feeling I should also be passing a process handle, which is obviously not the case. So then is RtlCopyMemory intended to copy from physical memory into a buffer?
Other questions (lol):
What IRQL should I be operating at?
How can I convert a system::string^ into a LPCVOID, (system::string^ is from taking the text from a windows forms textbox)
I'm totally willing to write my own algorithm, I just dont know anything about the fundamental structure of system::string^. I dont even know what that ^ is lol...
|
|
|
|
|
You can pass in a buffer from user mode to kernel mode by defining custom IO control codes with different transfer types.
Read about it here - Defining Custom I/O Control Codes[^]
|
|
|
|
|
Hello,
Could anyone tell me how to access the CPU register in C?
Thanks
|
|
|
|
|
In Windows and x86, you can use the __asm keyword to write inline assembly and then access the registers by its name (eax, ebx etc.).
__asm is not supported in x64.
|
|
|
|
|
Thanks, Superman. And I wonder whether the keyword "register" is possible to be used to specify a register in the processor?
|
|
|
|
|
No. The register keyword is used as a hint to the compiler to store the variable into a general purpose register instead of a memory location.
|
|
|
|
|
There's no guarantee that the variable will be put into a register at all, so leave alone a "specific" register.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hi guys!!
I have to change the colors of all windows in my MFC program for simulate a "nigth color/vision" effects, there's a fast way to do it?
For example change some register keys and restart the program.
Marco
|
|
|
|
|
Colours in windows are either set in the class (default background) or painted in the OnPaint() event, so your code needs to handle it. I don't think there is anything in the Registry that could help.
|
|
|
|
|
|
|
Hi,
I made one combobox which i canwrite some text, in C# and i build that as DLL.
And i call this to VC++.
My problem, when it is in C#,i can write text in combobox.
But in VC++,i cannot write.
When i press alphapets in keyboard nothing is displayed in combobox. only beep sound is coming.
Whats the mistake?
Anu
|
|
|
|
|
Anu_Bala wrote: Whats the mistake?
Given the information you have provided it could be anything at all. Perhaps there is something wrong in your code.
|
|
|
|
|
this i coded in C#
private void Callbutton_Click(object sender, RoutedEventArgs e)
{
String msg = comboBox1.Text;
comboBox1.Items.Add(msg);
CallClick(msg);
}
And im using this in VC++ and im using that 'msg' in vc++ code.
Anu
|
|
|
|
|
I am still none the wiser as to what you are doing. The above code is for a private C# event handler, called when some button is pressed. How does this relate to C++ and what exactly do you mean by the statement:
Anu_Bala wrote: And im using this in VC++ and im using that 'msg' in vc++ code.
|
|
|
|
|
Yes i created on C# dll with this coding and im using that in VC++.
public partial class SecondTab : UserControl
{
public delegate void NameTab(string msg);
public static event NameTab CallClick;
public SecondTab()
{
InitializeComponent();
}
private void Callbutton_Click(object sender, RoutedEventArgs e)
{
String msg = comboBox1.Text;
comboBox1.Items.Add(msg);
CallClick(msg);
}
}
This is my C# coding.
Im using in VC++ as follow
Tabcontrol::SecondTab::CallClick += gcnew Tabcontrol::SecondTab::NameTab(OnCallClick);
static void OnCallClick(System::String ^ msg)
{
CString m = msg;
}
I think now you understand my objective..
Anu
|
|
|
|