|
Ahhhh yeah i think,....
What is this statement called in C++ For Loop ?
|
|
|
|
|
|
Can it be used like this.
EXP_USHORT Reset_All_Relais(void)
{
for (int nRelay=1; (nRelay <= 25); nRelay++)
{
return ScoUniSetRelay (nRelay, 0);
}
}
And what does my compiler means specificly with:
arning C4715: 'Reset_All_Relais' : not all control paths return a value
Linking...
|
|
|
|
|
no, what should the function Reset_All_Relais returns ?
now, the first time the function ScoUniSetRelay is called it will return the Reset_All_Relais function.
remove the return in the loop and place it at the end.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
its suppose to give this back
return ScoUniSetRelay(relay,0);// for each relay the next
return ScoUniSetRelay(relay,0);// Number untill 25 including 25
return ScoUniSetRelay(relay,0);//
return ScoUniSetRelay(relay,0);
return ScoUniSetRelay(relay,0);
return ScoUniSetRelay(relay,0);
thats y i wanted return not at the end
PS: Suppose to give all tha back for the robo to set all the Relay back to off. ScoUniSetRelay(relay,0) 0=off relay for which one.
|
|
|
|
|
if you do that it will return on the first one, and never do the other ones.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
EXP_USHORT Reset_All_Relais(void)
{
for ( int relay = 0 ; relay <= 25; relay ++ )
ScoUniSetRelay(relay, 0);
}
return
}
Something like this ?
B\c that is not working for me never used Loop n that stuff before so something is missing i think. ; gives me another error
EDIT !!!!!
PS: I dont need any return crap I can make the proto type run with out Return to check if it was or not just need to to make that damn thing do her stuff.
THANKS ALOT !!!!
|
|
|
|
|
i think you'd better take a piece of time to learn about at least C, or C++ if needed, because you really lacks in every basic knowledges on the language...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I wont argue with you but i do LOL.
I was assigned to this knowing be able to write it in java. But all the application adn control programs can only understand C++ or Pascal and some otehr machine language.
Truthfully i think i am getting the hang onf it though after the explaination of loop for.
=) !!!
My 8 page program is done and later ima go test it.
Worst thing that can happen the Robo pokes everything to oblivion hahah !!!!
Thanks guys
|
|
|
|
|
Please don't misunderstand me when I say this, but you should have a firm grasp of the basic C/C++ control structures and the return statement before embarking on your project.
This is what you need to do:
void Reset_All_Relays()
{
for (int nRelay=1; (nRelay <= 25); nRelay++) {
ScoUniSetRelay (nRelay, 0);
}
}
If ScoUniSetRelay() returns a status, you need to decide how Reset_All_Relays() should behave if it encounters an error - i.e. should it interrupt the loop, ignore the error, continue with the loop but return the failure notification to the caller, something else...?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Yeah Took me awhile to get the grasps for what those things are. USHORT needs return value Void not etc etc Long and so =)
Now i can dig in C++ Not so much diff than java basics are same. just diff looks confused the hell outta me !!!
beside writing 8 page code and this is like 1 and half week on C++ for first time aint that bad huh ??? Maybe i am slow.
|
|
|
|
|
|
its suppose to give this back
return ScoUniSetRelay(relay,0);// for each relay the next
return ScoUniSetRelay(relay,0);// Number untill 25 including 25
return ScoUniSetRelay(relay,0);//
return ScoUniSetRelay(relay,0);
return ScoUniSetRelay(relay,0);
return ScoUniSetRelay(relay,0);
thats y i wanted return in it the Machine responses to those commands.
if it gives out ScoUniSetRelay(15,0) relay 15 will turn off. i jsut wanted a collective command to turn all 0-25 off including 0
PS: Suppose to give all tha back for the robo to set all the Relay back to off. ScoUniSetRelay(relay,0) 0=off relay for which one.
I used CD MSDN
|
|
|
|
|
Maximilien wrote:
msnd works ... I searched this : http://search.microsoft.com/search/results.aspx?view=msdn&st=b&na=82&qu=for+loop+c%2B%2B&s=1[^]
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi folks..
Is there a way to read an exe file's version info, icon etc programatically
using C/C++ ?
e.g How do we read notepad.exe's version info via C/C++ calls?
thanks in advance..
|
|
|
|
|
munawar1968 wrote:
exe file's version info
GetFileVersionInfo
munawar1968 wrote:
icon
ExtractIcon
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Thanks man..
can this info (gathered via getfileversion,extracticon) be used to set the
version /icon of another exe file programmatically?
|
|
|
|
|
munawar1968 wrote:
another exe file programmatically?
Nope, you have to use these api for Programmatically changing resource in other file :-
BeginUpdateResource,UpdateResource and EndUpdateResource.
And Here is article relating to above Api's
http://www.codeproject.com/cpp/UpdateResource.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Exactly what i wanted...
thanks a million
|
|
|
|
|
Hi,
There has to be a library function that does this? I need to convert a path from say:
C:¥Program Files¥Mozilla Firefox¥firefox.exe
to
C:¥¥"Program Files"¥¥"Mozilla Firefox"¥¥firefox.exe
The reason is I need to pass the full path name to _spawnl
I wrote a simple function to do this, but is there a library function that already does this?
Thanks in advance.
|
|
|
|
|
tsss,
no need to do this
the strings using doubles \\ are because when you code, the single \ is used as the escape characters.
but if you get the path from say an edit box, the \ (written alone) are in the same format.
in brief, you need double back-slashes only in design/coding time...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
You know, it's really weird, but with _spawnl I had to do this for it to work otherwise I got all these weird errors.
Anyway, I have just found the wonderful function CreateProcess().
Thanks!
|
|
|
|
|
but where did the string you were passing to _spawnl() come from ?
your source code ? or was it an entry the user passed to the program ?
anyway, you can use - for example - this functions :
CString strPath;
<font color=green>
strPath.Replace(<font color=gray>"\\"</font>, <font color=gray>"\\\\"</font>); <font color=green>
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
have you tried putting the entire path inside double quotes ?
csPath = "\"C:\\what ever\\file.exe\"";
just a thought.. don't know if it'll work or not
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thanks for the answers everyone. I moved to using CreateProcess() which just accepts a path like:
CString path = _T("\"c:\\path with spaces\\file.exe\"");
with _spawnl() I had to put quotes around every path element with spaces in it like so:
CString path = _T("c:\\\"path with spaces\"\\file.exe");
|
|
|
|