|
meixiang6 wrote: Any chance of typing the entire code in C as well?
I'll leave that as an exercise for the reader...you remember I said it was easier in C++
It's not too much different - fgets is roughly equivalent to getline. Rather than adding string objects together, you use strcpy to copy the command into a character buffer, then strcat to add the line you've read from the file to the end of the buffer. Then you pass the buffer to the system command.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thanks Stuart for the information, I am a very new newbie and have no idea how that looks like in C, any chance of someone writing that in C ?
apologizes for the inconvenience
|
|
|
|
|
You'll gain a lot more learning how to do it yourself.
This page[^] has code that reads a file line by line (search for 'fgets').
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks Stuart, I got it working with this, not sure if the code is right thou but it works...
#include <stdio.h>
#include <string.h>
int main()
{
FILE *f;
char string[1000];
char str[1000];
f = fopen("file.txt", "r");
if(!f) {
printf("Couldn't open file.txtn");
return 1;
}
while(fgets(str, 1000, f)) {
/* printf("%s", str); */
strcpy (string, "ls -la ");
strcat (string, str);
system (string);
}
fclose(f);
return 0;
}
<div class="ForumMod">modified on Thursday, February 19, 2009 8:56 PM</div>
|
|
|
|
|
meixiang6 wrote: char string[1000];
I know this is being nit-picky, but you might want to make this 7 bytes larger than str . If str contains 999 bytes, copying that plus "ls -la " is going to overflow string .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Aside from what David said, that code's fine
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
am a newbie to win32 console programming and i was given
to
Create the editor of resources files of application, which allows to form the following facility
-the icon
- the menu
- the text
- the dialogue windows
i was able to write a code to for the text but i cant for the icon , i really dont have idea.
Please help so we could share ideas together thanks
|
|
|
|
|
As newbie, they could give you as well the task to discover the origin of the Universe, I suppose.
My solidarity.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: discover the origin of the Universe
No problem, it is where it always has been: at (0, 0, 0, 0).
You may add more dimensions if you are so inclined.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: it is where it always has been: at (0, 0, 0, 0).
What is that RGBA values?
|
|
|
|
|
It holds true for both xyzt and ARGB (those were the really dark ages).
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: those were the really dark ages
Now you're getting the hang of it! That's as bad as anything I could come up with.
|
|
|
|
|
So it's good I reckon
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Welcome in the THHB [^]
(unfortunately, at the moment, I'm not able to add a welcome message in my blog).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
To be honest, I didn't think I understood the meaning of the list since I wasn't already on it.
|
|
|
|
|
With an alpha value of 0 I think that would have been the really transparent ages.
|
|
|
|
|
Yep, however without any light the difference is futile.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
That's never true, there are the (A)RGB space vacuum fluctuations...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
erm...
Is this a joke?
Jokes belong in the lounge
LOL
|
|
|
|
|
HI,
I have an OCX control written in C++..This control has been used in our Asp.net web application..Here I just need to access a hidden control placed in the webpage using the activex..I am not much familar in C++..My requirement is to write or keep the content to the hidden control after when the activex done with its operation.Then I need to use that content in our webapplication BL to save in Database..
I would really appreciate any help with code sample.
Thanks much in Advance.
Rahul.
SoftwareDeveloper(.NET)
|
|
|
|
|
Hi,
Just wanted to know whether it is possible to "Adding Custom tab on "Default Website Properties" (IIS)"?
Any links on this would appreciated.
Regards,
Mayur M
|
|
|
|
|
So, is that C++? Is it MFC? No - so this isn't the right forum, is it? Try this one[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Writing an applciation in MFC to add another tab along with the existing ones.
"Default Website Properties (IIS)" is just an example. It can be any windows built-in dialog based, may be in the "System Properties" dialog. Just adding another custom tab to it along with the existing.
|
|
|
|
|
Sorry - jumped to an incorrect conclusion.
Anyway - it's apparently possible with IIS 7[^].
If it's possible with IIS 6 or earlier, you'll probably have to implement some form of MMC plugin DLL, I suspect?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|