|
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
I have used this free tool on Windows 7 for years, https://www.codeproject.com/Articles/354/A-Utility-to-Clean-Up-Compiler-Temp-Files , it's useful.
I now want to use this utility to clean up compiler temp files on Windows 10, but after registered the DirClean.dll file, the two menu items do not show on the context menu. I check the source files, but I can't find what is wrong.
Thank you for help!
|
|
|
|
|
Please use the forum at the end of the article so the person who wrote the article can help you.
|
|
|
|
|
There is few reply in the article forum, so I start this thread here. Thanks!
|
|
|
|
|
i wanna ask, can anyone suggest any good tutorials references for learning C from the beginning, especially for the latest C version (C17, afaik) ?
refs can be web, e-books, or anything
note:
i tried google. found no tutorials for this.
|
|
|
|
|
C is a rather stable language, every standard doesn't add so many features like happens, for instance, with C++ , so you may find (of the tons available) a good tutorial on a previous version (e.g. C99 or C11 ) and start learning. Then, in order to complete your knowledge, you may access the freely available 'final draft of the standard' (external link in the very wikipedia page: C17 (C standard revision) - Wikipedia[^].
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
but there's errors in old syntax if we use old tutorials
coz, there's tutorials using old syntax of C and that's not used in today's C's syntax anymore
e.g.: i have K&R book and their example is like:
#include <stdio.h>
main () {
}
that's why i'm looking more for tutor that suit with the latest C's syntax, which is C17
|
|
|
|
|
I didn't say it has not changed. It changed, but just a little. You haven't to go back to K&R. While probably there aren't yet many tutorials on the latest standard, there are many many available good ones for recent versions of it. That could be your fishing pond.
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
|
i searched more for C17 and not just C tutorials
coz, there's tutorials using old syntax of C and that's not used in today's C's syntax anymore
e.g.: i have K&R book and their example is like:
#include <stdio.h>
main () {
}
i'm looking more for tutor that suit with the latest C's syntax, which is C17
|
|
|
|
|
|
|
I was trying to use win API GetComputerObjectNameW as below but I am getting error. Can someone help me.
#include <iostream>
#include <atlbase.h>
#include <secext.h>
typedef enum {
NameUnknown,
NameFullyQualifiedDN,
NameSamCompatible,
NameDisplay,
NameUniqueId,
NameCanonical,
NameUserPrincipal,
NameCanonicalEx,
NameServicePrincipal,
NameDnsDomain,
NameGivenName,
NameSurname
} EXTENDED_NAME_FORMAT, *PEXTENDED_NAME_FORMAT;
int main()
{
EXTENDED_NAME_FORMAT enf = NameFullyQualifiedDN;
LPWSTR pwszComputerName;
DWORD dwLen;
dwLen = 0;
GetComputerObjectNameW(enf, NULL, &dwLen);
pwszComputerName = new WCHAR[dwLen + 1];
if(NULL == pwszComputerName)
{
return 0;
}
if(!GetComputerObjectNameW(NameSamCompatible, pwszComputerName, &dwLen))
{
delete pwszComputerName;
return 0;
}
sbstrTrustee = pwszComputerName;
wprintf(L"GetComputerObjectName: %s\n", pwszComputerName);
delete pwszComputerName;
}
Some of Error message is as below.
C:\Program Files (x86)\Windows Kits\8.1\include\\shared\secext.h(117): error C2146: syntax error: missing ';' before identifier 'GetUserNameExA'
C:\Program Files (x86)\Windows Kits\8.1\include\\shared\secext.h(121): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Windows Kits\8.1\include\\shared\secext.h(126): error C2086: 'BOOLEAN SEC_ENTRY': redefinition
C:\Program Files (x86)\Windows Kits\8.1\include\\shared\secext.h(117): note: see declaration of 'SEC_ENTRY'
C:\Program Files (x86)\Windows Kits\8.1\include\\shared\secext.h(126): error C2146: syntax error: missing ';' before identifier 'GetUserNameExW'
C:\Program Files (x86)\Windows Kits\8.1\include\\shared\secext.h(130): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
|
|
|
|
|
Why do you redefine the EXTENDED_NAME_FORMAT enumeration? 
|
|
|
|
|
I first try without defining enum after that try with enum. In both case I am getting compilation error.
|
|
|
|
|
Add these definition:
#define _WIN32_WINNT 0x0500
#define SECURITY_WIN32
Remove the redefinition of enum.
Define the sbstrTrustee variable.
// edited: also don't forget to include the Secur32.lib library.
|
|
|
|
|
Hi Victor,
I have modified program according to your suggestion but I am not getting expected result. I want to use NameFullyQualifiedDN enum value and get the fully qualified distinguished name (for example, CN=Jeff Smith,OU=Users,DC=Engineering,DC=Microsoft,DC=Com).
Regards,
Rajnesh
|
|
|
|
|
Sorry, I don't know what is wrong/correct in your test.
I've just tested your code and got the result in the form:
[my_domain_name].[my_computer_name]$
wich is in my case 100% correct.
|
|
|
|
|
Good morning,
You are including the wrong header. Remove secext.h and add:
#include <Security.h> The error message is telling you that it doesn't know the definition of SEC_ENTRY .
|
|
|
|
|
Hi All,
//program to place even numbers in one array and odd numbers in another array
PFA code.
#include<stdio.h>
void main()
{
int array[20],array1[20],array2[20],i,n,j;
printf("enter how many array elements\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&array[i]);
="" }
="" ***************even="" odd="" in="" array="" elements***************=""
for(i="0;i<n;i++)
{
" if(array[i]%2="=0)
"
="" {
="" array1[i]="array[i];//even" array
="" }
="" else
="" array2[i]="array[i];//odd"
}
="" ******************printing="" elements)*********="" for(i="0;i<n;i++)
" printf("="" even="" is:%d\n",array1[i]);="" printing="" array
}
printf("\n");
for(j="0;j<n;j++)
{
" is="" :%d\n",array2[j]);="" array
}
}
="" output="" what="" i="" got:
enter="" how="" many="" elements
5
1
2
3
4
5
="" is:1970776="" to="" avoid="" this="" is:2
="" is:-1968723210="" my="" output
="" is:4
="" is:4202864="" this
="" :1
="" ="" am="" getting="" :3
="" :32762="" why="" addresss="" junl="" value
="" :5
--------------------------------
process="" exited="" after="" 7.24="" seconds="" with="" return="" value="" 5
press="" any="" key="" continue="" .="" .<="" pre="">
modified 18-Feb-21 0:51am.
|
|
|
|
|
You are putting holes in your arrays of even and odd elements. In order to avoid that, you need to maintain two separate variables to keep track of how many even and odd items have been added so far. Try
#include <stdio.h>
#define SIZE 20
int main()
{
int items, odd_items, even_items;
int array[SIZE], odd[SIZE], even[SIZE];
printf("enter how many array elements\n");
scanf("%d",&items);
odd_items = even_items = 0;
for (int n=0; n<items; ++n)
{
printf("enter item %d:\n", n);
scanf("%d", &array[n]);
if ( (array[n] % 2) == 0)
{
even[even_items] = array[n];
++even_items;
}
else
{
odd[odd_items] = array[n];
++odd_items;
}
}
printf("array items\n");
for (int n=0; n<items; ++n)
printf("%d ", array[n]);
printf("\n");
printf("even array items\n");
for (int n=0; n<even_items; ++n)
printf("%d ", even[n]);
printf("\n");
printf("odd array items\n");
for (int n=0; n<odd_items; ++n)
printf("%d ", odd[n]);
printf("\n");
return 0;
}
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
5, but you should get 10 for looking at code formatted this way.
|
|
|
|
|
Thank you.
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
Hi,
#include<stdio.h>
int main()
{
char str[20] = "Hello";
char *const p=str;
*p='M';
printf("%s\n", str);
return 0;
}
output:
Mello
As per my knowledge when we use const then we can't change a char in t then how output is Mello instead of Hello.
|
|
|
|
|