|
|
Try binning the extern "C" off the front of the function. If that compiles without error then enclose the lot in a extern "C" {} block.
Cheers,
Ash
|
|
|
|
|
I don't want to check a path if it exists, I would like to use some type of command to query if a drive actually exists before I do any maniplulation or anything else on it, like X:, G: ...etc
Thanks
|
|
|
|
|
|
Have you tried _chdrive() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Use can use the PathFileExists API.
|
|
|
|
|
MFS System Utility[^]
"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
|
|
|
|
|
delete
modified 2-Apr-21 5:21am.
|
|
|
|
|
I am not sure that I understand your question but if you have Visual Studio 2010 then you can code in C, C++ or C#. Perhaps you could rephrase your question or show the code that you are having trouble with.
It's time for a new signature.
|
|
|
|
|
How can i code/compile C?
What project i must open?
|
|
|
|
|
Which version of Visual Studio do you have?
Ultimate / Pro or VC++ Express?
Please check my other reply to this question.
--
"Programming is an art that fights back!"
|
|
|
|
|
|
what I do (using VS Express) in such case is create a C++ project of the kind you want, then add a file with extension .c and finally remove the ones with extension .cpp; I typically also have to change the settings about precompiled headers.
I wish there were an easier way, but I don't see one.
|
|
|
|
|
Luc Pattyn wrote: I wish there were an easier way
You can write pure C in a .cpp source file.
It's time for a new signature.
|
|
|
|
|
that is a shocking idea, probably correct, but shocking nonetheless.
why would I drag the wrong extension with me?
|
|
|
|
|
Richard MacCutchan wrote: You can write pure C in a .cpp source file.
But then your code won't be compiled as C code, in the sense that it is not pure C anymore (you'll be able to declare variables everywhere in a function for instance). If you specify the extension as .c, your file will be compiled as pure C code.
|
|
|
|
|
Cedric Moonen wrote: If you specify the extension as .c, your file will be compiled as pure C code.
If you really like to be a dinosaur
It's time for a new signature.
|
|
|
|
|
Awww... I am a dinosaur then
I had to do that for a project a couple of weeks ago. But I have to say that moving from C++ to C is really horrible.
|
|
|
|
|
or don't like to carry a big run-time library you don't need, e.g. in embedded systems.
|
|
|
|
|
Luc Pattyn wrote: I typically also have to change the settings about precompiled headers.
And say the compiler to use C. On the project properties set "Compile as C".
Luc Pattyn wrote: I wish there were an easier way, but I don't see one.
Much easier way is to create an empty project and add your files. There change the extension when you add.
Best wishes,
Navaneeth
|
|
|
|
|
N a v a n e e t h wrote: set "Compile as C".
I never did that, it seems to know from the extension (as it should IMO).
N a v a n e e t h wrote: create an empty project
ah. of course. I'll have to remember that. thanks.
|
|
|
|
|
Luc Pattyn wrote: it seems to know from the extension (as it should IMO).
I don't think so. On default settings it uses C++ compiler to compile the code irrespective of what extension it is. You can see this from the output window. This will work because most of the C code is also valid on C++. When you set the "Compile as C" option, you can see adiitional compiler flag getting added to the compile command and it defaults to the C89 standard.
Best wishes,
Navaneeth
|
|
|
|
|
I now located the "compile as C" switch (project Properties/Configuration Properties/CC++/Advanced); I'm pretty sure I've never used it before. I will experiment next time I need some native code stuff. Thanks.
|
|
|
|
|
I just discovered Visual Studio 2008 Express Edition applies /TC (i.e. Compile as C code) for a C file inside a C++ project (which has the setting /TP, i.e. Compile as C++ code). So there is no need to change the setting provided the extension is correct.
|
|
|
|
|
You are correct. It does automatically. Thanks for pointing that out!
Best wishes,
Navaneeth
|
|
|
|