|
Nuray wrote: (1) Who uses C?
I actually asked 'who uses C for windows programming'. I'm sure some people do, but not many.
Nuray wrote: But this doesn't mean that I never look for better one.
That's fair enough
Nuray wrote: I think C# can attract more beginners. It is not as powerful as C++ for the time being but eventually will catch up.
It will never catch up, in terms of raw power. We just won't care because our processors will get bigger and bigger. It's certainly catching up in terms of the language itself, I agree there.
I agree that the C# editor continues to have more features than the C++ editor.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/registry.asp
All about windows registry and how to use.
|
|
|
|
|
|
this is a simple question, i think there is probably a simple answer. im a newb with c
i looked on google but couldnt find out what my problem was.
i have this code
for(i=0; i < something; i++) {
sprintf(filename, "%i", i);
f = fopen(filename, "w");
}
how can i make it open files like
filename1
filename2
filename3
filename4
...etc?
thanks.
|
|
|
|
|
I hope this can do it:
sprintf(filename,"filename%i",i);
this is this.
|
|
|
|
|
Write a routine that does the following: for a given value N, create and initialize an N*N matrix. deduce the initialization algorithm from the following examples.
Example1: N=2
1 2
4 3
Example2:N=3
1 2 3
8 9 4
7 6 5
Example3: N=4
1 2 3 4
12 13 14 5
11 16 15 6
10 9 8 7
|
|
|
|
|
I doubt this is even remotely optimized, but here is a qad solution:
#define UP (UCHAR)0
#define DOWN (UCHAR)1
#define LEFT (UCHAR)2
#define RIGHT (UCHAR)3
UCHAR **Matrix( UCHAR n )
{
UCHAR **Result = new UCHAR *[n];
for ( UCHAR i = 0; i < n ; i++ )
{
Result[i] = new UCHAR[n];
memset( Result[i], 0, sizeof(UCHAR)*n );
}
UCHAR r, c;
UCHAR Dir;
UCHAR cc;
r = 0;
c = 0;
i = 1;
Dir = RIGHT;
while ( true )
{
cc = Result[c][r];
if ( cc != 0 )
{
if ( Dir == RIGHT )
{
if ( Result[c-1][r+1] == 0 )
{
Dir = DOWN;
c--;
r++;
}
else
{
break;
}
}
else
if ( Dir == DOWN )
{
if ( Result[c-1][r-1] == 0 )
{
Dir = LEFT;
c--;
r--;
}
else
{
break;
}
}
else
if ( Dir == LEFT )
{
if ( Result[c+1][r-1] == 0 )
{
Dir = UP;
r--;
c++;
}
else
{
break;
}
}
else
if ( Dir == UP )
{
if ( Result[c+1][r+1] == 0 )
{
Dir = RIGHT;
c++;
r++;
}
else
{
break;
}
}
}
Result[c][r] = i;
switch ( Dir )
{
case RIGHT:
if ( c == n - 1 )
{
r++;
Dir = DOWN;
}
else
{
c++;
}
break;
case DOWN:
if ( r == n - 1 )
{
c--;
Dir = LEFT;
}
else
{
r++;
}
break;
case LEFT:
if ( c == 0 )
{
r--;
Dir = UP;
}
else
{
c--;
}
break;
case UP:
if ( r == 0 )
{
c++;
Dir = RIGHT;
}
else
{
r--;
}
break;
}
i++;
}
for ( r = 0; r < n; r++ )
{
for ( c = 0; c < n; c++ )
{
printf( "%3u ", Result[c][r] );
}
printf( "\n" );
}
return Result;
}
int main(int argc, char* argv[])
{
Matrix( 5 );
return 0;
}
viola.
|
|
|
|
|
|
Hi I was reading Modern C++ Design by Andrei Alexandrescu. The author mentions an interesting technique in chapter 2 where you can use template specialization to select between the overloaded functions. To try it out I had written the following code
template <int v="">
struct Int2Type
{
enum { value = v };
};
enum { SimpleDispatch = 1, ComplexDispatch = 2 };
class Dispatcher
{
private:
int m_iDispatchType;
protected:
void DoDispatch(Int2Type<simpledispatch>)
{
AfxMessageBox("Simple Dispatch called");
}
void DoDispatch(Int2Type<complexdispatch>)
{
AfxMessageBox("Complex Dispatch called");
}
public:
Dispatcher() : m_iDispatchType(SimpleDispatch)
{}
Dispatcher(int iDispatchType):
m_iDispatchType(iDispatchType)
{}
void DoDispatch()
{
DoDispatch(Int2Type<m_idispatchtype>()); -------- [1]
switch(m_iDispatchType)
{
case SimpleDispatch:
DoDispatch(Int2Type<simpledispatch>());
break;
case ComplexDispatch:
DoDispatch(Int2Type<complexdispatch>());
break;
}
}
};
unfortunately unless I comment out line marked [1] the class does not compile, to make the class compile I had to use to switch alternative. So my question is why can't I write a above code. In the book the author has taken a bool variable example which is passed as a template variable.
I am missing something here? Doesn't the use of switch makes the code behave like the standard way, I mean If I have to use switch then I do not need template specialization here.
Any help is appriciated.
Thanks
|
|
|
|
|
|
Yep I am using VC++ 6.0.
Did microsoft fixed it in VC++ 7.0 or VC++ 7.1 ??
|
|
|
|
|
Hello!
I'm working on ARM embedded device. I have Flash device mapped into memory space trough which I controll it. I have the following problem:
I have to write some 32bit data to some address in memory. When I write to the location that is not modulo of number 4, I get exception;
example:
0x01000000 - ok
0x01000001 - exception
0x01000002 - exception
0x01000003 - exception
0x01000004 - ok
How to overcome this? Is it possible to write 32 bit data in atomic way and not first upper and then lower 2 bytes?
Rostfrei
-- modified at 3:30 Thursday 20th October, 2005
|
|
|
|
|
pragma pack 1 ? Haven't really thought this thru, but worth trying ~
|
|
|
|
|
Can software agent be written in VB.net to control consumption of computer energy such as monitors,i.e.putting monitor in sleep mode or stand by?
|
|
|
|
|
I create a server to listen the TCP command , such as HTTP command GET/POST etc.
However , I do not want to parse the command text.
How to know the client , such as IE, has completed transfering the command?
Thanks!
|
|
|
|
|
According to the HTTP spec, the request is finished with an empty line, so you have to wait for a double line feed.
POST is more complicated, your server has to use the return code "100 Continue" (unless the client is HTTP/1.0) and then you'll get the POST data, though many clients send it directly and don't wait for/require the 100-Continue.
|
|
|
|
|
Hello,
Can anybody help me in determining lan connectivity.
I want that whenever my lan cable is unplugged my program should be
get a notification.
With Rgds
VC++
|
|
|
|
|
WebConn error LNK2019: unresolved external symbol __imp__InternetOpenA@20 referenced in function _main
My program "WebConn" keeps getting this error when ever I use items in the wininet.h class.
I'm using Visual Studio .Net 2003, C++.
Any help would be great!
Brad
<br />
#define WINVER 0x0400<br />
#include "stdafx.h"<br />
#include <windows.h><br />
#include <wininet.h><br />
<br />
int main()<br />
{<br />
HINTERNET hInternetRoot;<br />
hInternetRoot = InternetOpen("My Agent", INTERNET_OPEN_TYPE_PROXY, "127.0.0.1", "<local>",0);<br />
<br />
return 0;<br />
}<br />
|
|
|
|
|
link Wininet.lib in project settings
|
|
|
|
|
Hi fellows
I have the jpeglib.h included in my code to do some works with images.
When I compile, the compiler show the following message:
[Link error] undefined reference to jpeg_destroy_decompress(jpeg_decompress_struct*)
There are a lot of messages like this, all of them are Link error problems.
The jpeglib.h lies in the include folder of my Dev C++ with the jerror.h, jconfig.h.
What's going on? ![Confused | :confused:](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_confused.gif)
|
|
|
|
|
Hello,
I am making a virtual disk driver based on filedisk,
it is working very well under winxp but when i unmount the drive it doesn't disappear, instead it appears with a question mark
however it formats with all file systems under winxp.
on win 2000, it formats only under NTFS, not fat and fat32.
can u please help me with these 2 problems,
i mean the question mark under xp and the format problem under win2k
thanks in advance
Ahmed Abbas
|
|
|
|
|
Where can you create your virtual drive?
ps: This question supposted to be under "Operating Systems / SysAdmin" not in C++/CLI aka managed c++
|
|
|
|
|
Hi fellows
Someone knows how can I convert a BYTE to an integer?
Thanks
|
|
|
|
|
You should be able to use
BYTE myByte = 4;
int myInt = (int) myByte;
There is probably some newfangled way to do this, but C-style casting usually works for me.
C++ can use cooler casting operators, just google "c++ casting." But in this case C++ casting is probably unnecessary.
|
|
|
|