|
Thanks for the link! I am not sure how I missed these. I searched the archive on almost every key word I could think of.
|
|
|
|
|
Sadly, CP's search leaves a lot to be desired. But the quality of the articles and the community more than makes up for it.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
I want to create multithread, each thread read a file, how do write in SDK, write your suggestion.
Thank you.
regards,
Inba.
|
|
|
|
|
inbha wrote:
I want to create multithread...how do write in SDK
Use _beginthread() for this.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
It is better to use IOCP (IO completion ports) for such a task. See CreateFile and ReadFile() in the MSDN library.
John
|
|
|
|
|
Developing application: WinCE, hhp Dolphin9500.
Is there a function to set the keyboard to alphabetic?
|
|
|
|
|
Hi all,
I'm beginning the development of a context menu shell extension on windows 2000 and I have a question. I want to take different actions and build different menu entries depending on what I click, background or file. Which is best: developing two different projects, what will create two different DLLs, or develop only one project and let the ifs and elses treat the differences for me, creating only one DLL? If the second case is the ideal one, how do I differenciate between a file or a background click, for example, in the QueryContextMenu?
Thanks,
Luiz.
|
|
|
|
|
You can set the registry for directory / * file context menus to point to two different GUIDs that
both point back to the same DLL.
So you would have two different COM classes (e.g. CLSID_DirectoryContext & CLSID_FileContext) in your
DLL which would both implement the IContextMenuX, etc interfaces as necessary.
So, both being handled in one DLL is not only possible, it is pretty easy.
Iain.
|
|
|
|
|
Please help me with a segment code which can redirect the output to a file instead of using >> in the commandline. I am using c language.
oam
|
|
|
|
|
Try this:
FILE *file;
file = fopen("C:\\Progrem files\\test.txt","w");
CString output;
for(int i = 0 ; i < 10 ; i++)
{
output.Format("this is test string number %d",i);
fputs(output.GetBuffer(output.GetLenght() + 1),file);
}
fclose(file);
now,if you will open the test.txt file in your C:\Program files - guess what???
Good luck,
Eli
|
|
|
|
|
FILE *file;
E:\process.c(145) : error C2275: 'FILE' : illegal use of this type as an expression
oam
|
|
|
|
|
Have you included stdio.h ? However, if you are going to use MFC, I would construct a CFile object instead.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
yes i have included #include stdio.h Im using visual C. How can i construct a struct CFile?
oam
When opportunity knocks, open the door as it might comes once in a time
|
|
|
|
|
mpapeo wrote:
How can i construct a struct CFile?
I (erroneously) assumed you would be using MFC.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
This error may be incorrect! The code provided by eli5021979 is correct, accept that it is not competely C code. The CString is an C++ class, get rid of it. Use a char buffer in stead: char buffer[128] (whatever size you need).
The error will probably disappear.
Heck, in the example code, I would get rid of the temporary buffer and just use fprintf() instead.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
what is the loop for in the above code, i get a lot of errors. Pliz give the idea of how to write the segment code in C
oam
|
|
|
|
|
mpapeo wrote:
what is the loop for in the above code,
It executes the two statements within the curly brackets 10 times.
mpapeo wrote:
i get a lot of errors.
And those are??
mpapeo wrote:
Pliz give the idea of how to write the segment code in C
Hasn't that already been provided?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
mpapeo wrote:
what is the loop for in the above code
For dimenstartion puposes only! It should produce a file containing the following:
"this is test string number 0this is test string number 1this is test string number 2this is test string number 3this is test string number 4this is test string number 5this is test string number 6this is test string number 7this is test string number 8this is test string number 9"
Note: All variables must be declared at the start of the scope in C programs.
You can not do things like for(int i=0;i<10;++i).
int DoFileOutTest1()
{
int i;
char buffer[64];
FILE *file = fopen("test.txt","w");
if( !file )
return 0;
for(i = 0 ; i < 10 ; ++i) {
sprintf(buffer,"this is test string number %d\n",i);
fputs(buffer,file);
}
fclose(file);
return 1;
}
int DoFileOutTest2()
{
int i;
FILE *file = fopen("test.txt","w");
if( file )
return 0;
for(i = 0 ; i < 10 ; ++i) {
fprintf(file,,"this is test string number %d\n",i);
}
fclose(file);
return 1;
}
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
<br />
FILE *file = fopen("test.txt","w");
<br />
E:\process.c(147) : error C2275: 'FILE' : illegal use of this type as an expression<br />
<br />
once i declared the FILE i get errors
oam
|
|
|
|
|
You need to find a book or sight on C programming.
Here:
1) Create and empty console project.
2) Create a new new file named simple.c.
3) Copy the following into simple.c.
#include "stdio.h"
int main(int argc, char* argv[])
{
FILE* fp = fopen("test.txt","wt");
if( fp )
{
int i;
for( i=0; i<10; ++i )
fprintf(fp,"Line %d\n",i);
fclose(fp);
}
return 0;
}
4) Press F5.
5) Open the file test.txt in you editor to see results.
That is all!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Well the thing worked and thanks. But now i want to specify the name of the input file on the commandline.
oam
|
|
|
|
|
Hi,
I have to Classes: CMyFirstClass, CMySecondClass. Now i need to get acces to a variable defined in CMySecondClass from CMyFirstClass, but CMyFirstClass also has a variable which i need to access from CMySecondClass. How to do ? Please Help
MFG
RedDragon2k
|
|
|
|
|
Declare each variable to be public .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Both variables are public. I believe i was to unprecise. The Problem are the #include directives. if i include MyFirstClass.h at CMySecondClass and include MySecondClass.h at CMyFirstClass. I get compiler errors
MFG
RedDragon2k
|
|
|
|
|
what are the errors you get?
|
|
|
|