windows&c

S

skyspy

hi friends,
i want to know that is it possible to link my c programme
with folder or file in windows, so when ever i click (try to open) the
folder first my programme will execute and after that according to
result of pro. folder/file will open/remain close.
-aakash
 
M

mailursubbu

skyspy said:
hi friends,
i want to know that is it possible to link my c programme
with folder or file in windows, so when ever i click (try to open) the
folder first my programme will execute and after that according to
result of pro. folder/file will open/remain close.
-aakash

You are playing in the wrong court. For this you need to change the
windows kernel.
 
K

Keith Thompson

skyspy said:
i want to know that is it possible to link my c programme
with folder or file in windows, so when ever i click (try to open) the
folder first my programme will execute and after that according to
result of pro. folder/file will open/remain close.

This is a Windows question, not a C question. You'll need to ask in a
Windows-specific newsgroup.
 
S

Simon Biber

skyspy said:
hi friends,
i want to know that is it possible to link my c programme
with folder or file in windows, so when ever i click (try to open) the
folder first my programme will execute and after that according to
result of pro. folder/file will open/remain close.

Compile this program and assign it as the default application to open
TXT files. Now, when you double-click a text file there is a 50% chance
of it opening and 50% chance of nothing happening. The decision is
controlled by the program.

You can write handlers like this for most file types. But not for
folders, to my knowledge.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(int argc, char **argv)
{
srand(time(NULL));
rand();
if(argc == 2)
{
if(rand() < RAND_MAX / 2)
{
char *buf = malloc(strlen(argv[1]) + 20);
if(buf)
{
sprintf(buf, "notepad \"%s\"", argv[1]);
system(buf);
free(buf);
}
}
}
return 0;
}
 
E

Elijah Cardon

Also don't dispense off-topic advice.
I believe that the OP is a friendly young man with good intentions. His
question is of the variety that we kick out the door pretty quickly in clc.
One thing you learn after a while is where programming languages stop and
OS's start. There IS intelligent life on usenet outside of this forum. It
takes a while to find, though.

What is germane to this forum? I don't know the answer to this question,
but, before tonight, I would have said that it is obsessed with finding
obscure errors. The paradoxes of finite-state automata ensure a ready
supply of these, and I think Johnny von Neumann has the last word on it:
avoid bad scenarios.

I would love to tell the story that motivates this response, but it can't be
done without telling how I intentionally hanged windows in a public emporium
using a guess from the C programming language. Ergo OT. EC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top