|
, well thats what I am not getting... for now I got around this problem using WinExec.. will try using CreateProcess without command prompt and using only application name directly (that will be on Monday).
PKNT
|
|
|
|
|
Kiran Satish wrote: well thats what I am not getting...
Well, aren't you calling GetLastError() to find out why?
"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
|
|
|
|
|
Hello
Anyone know of a good C++ program that will convert a Julian Date/Time, both date and time to
Normal Calender Date & Time?
Thanks in advance.
|
|
|
|
|
See here.
"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
|
|
|
|
|
The functions to do this are part of the standard run time; see here[^].
|
|
|
|
|
Hi,
I am writting a C++ program of FindFirstFile() and FindNextFile() function.I want to store the output from FindFirstFile() and FindNextFile() function in an array. So that i can send it using TCP Sockets.In send function it is necessary to have an array.So i want to store the output from FindFirstFile() and FindNextFile() in an array. I declare the array and use the FindFirstFIle() function as shown below
char firstfile[MAX+PATH];
firstdir=FindFileData.cFileName; //i have declare firstdir and otherdir as an array
otherdir=FindFileData.cFileName;
After all i compile the program in GCC compiler,I got the following error
ISO C++ forbids assignment of arrays
and if i complie the same program in Visual C++ compiler ,i got this error
left operand must be l-value|
but when i declear my array as firstdir[]="";
firstdir=FindFileData.cFileName; //i have declare firstdir as an array
i got following error
incompatible types in assignment of `CHAR[260]' to `char[1]'
so what is the error here? and can is it the right way to store the output in an array?
how to resolve this error?
|
|
|
|
|
it is C++ syntax error.
delete long story, re-post data type used, what is date type of firstdir and others?
|
|
|
|
|
Hi includeh10,
i use character array data type for firstdir.
char firstdir[]="";
firstdir=FindFileData.cFileName;
i got following error
incompatible types in assignment of `CHAR[260]' to `char[1]'
and if i declare
char firstdir[MAX_PATH];
firstdir=FindFileData.cFileName;
I got the following error
ISO C++ forbids assignment of arrays(in gcc compiler) and left operand must be l-value(in Visual C++ compiler).
please suggest me can i store the output from FindFileData.cFileName in an array.Actually its necessary to store the output in an array.
|
|
|
|
|
Firstly you cannot just store a string to an array, it needs to be copied from FindFileData.cFileName to some memory buffer, in order to use it later in the program. Secondly you have not allocated any space to your array so you cannot store anything in it. Thirdly your array is of the wrong type; but you knew that because the compiler told you.
I would suggest working through some basic C++ examples of using different types and arrays before tackling such an advanced project as this.
|
|
|
|
|
Hi Richard MacCutchan,
can you please suggest me what type of data type i should use?can i store the output from FindFirstFile() and FindNextFile() in an array?
|
|
|
|
|
ravi 12 wrote: can you please suggest me what type of data type i should use?
Well you need an array of strings, or more correctly char pointers, each of which needs to be initialised to point to a buffer large enough to hold the path name returned by FindNextFile() . Then you need to copy the returned path name into the next free item in the array, and continue your loop. however you still don't know how many items you will need to store, so you also need a mechanism for expanding your array.
As I suggested in my previous post, you should spend some time getting to know arrays of simple and complex types before trying this program.
|
|
|
|
|
Hi,
I want to store the output from FindFirstFile() and FindNextFile() function in an array.
Is there any way to store the output of FindFirstFile() and FindNextFile() in an array?please suggest me.
|
|
|
|
|
inputs any set integer from 1 to 3999 and separated by a comma then separates it then gets its average.
Example:
input: 1,2,3,8,4,6
compute its average
1+2+3+8+4+6=24
24/6=4
Output:4
...pls help
|
|
|
|
|
Tabang wrote: ...pls help
Well in this half of the universe 24/6 = 4!
|
|
|
|
|
Tabang wrote: ...pls help
With what? You have a multi-step problem here. You could start with:
#include <string>
#include <iostream>
void main( void )
{
std::string strInput;
cout << "Input: ";
cin >> strInput;
}
"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
|
|
|
|
|
DavidCrow wrote: std::string strInput;
I'm pretty sure that wouldn't work with Turbo C[^]
|
|
|
|
|
Details, details.
On an unrelated note, it's been 19 years since I used Turbo C. That was a fun product.
"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
|
|
|
|
|
Oh, I'm pretty sure David can do that with Turbo C .
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]
|
|
|
|
|
pls help me with the separation of commas from the set of numbers ...its hard
|
|
|
|
|
i guess... pls help me separate the commas from the numbers so i can calculate the average... it hard to separate it when im just a bigginer.. pls
|
|
|
|
|
Thanks. your codes are c++ i think?
|
|
|
|
|
It's not their fault. Actually, the people here are such experts that they can write a turbo c compiler in less time than what it would take for them to figure out if cout/cin or std::string is a C-language feature or not. They have risen much higher than the realms of specific programming languages. They only understand the language of bits and bytes and in their mind, both string and char are just a piece of f* memory holding some bits.
|
|
|
|
|
And what's your trouble about?
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]
|
|
|
|
|
I know what you want. Just tell me if I am correct.
int main(void)
{
int a,b,c;
scanf("%d,%d,%d",&a, &b, &c);
printf("\nYou just entered: %d, %d, %d", a, b, c);
}
Pay special attention to the commas used inside the scanf function. I think it addresses your doubt to some extent. I had this doubt all my life.
Second, I suppose you will say that above program is very rigid as it allows input of only 3 variables. What if the no. of variables is not known.
Very valid question, I say. Only I have forgotten how to work with console and it give me creeps to find out about gets etc. See this [^]
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
int main(void)
{
char input[255];
int sum = 0;
int num = 0;
gets(input);
char* token;
token = strtok(input, ",");
while (token != NULL)
{
sum += atoi(token);
++ num;
token = strtok(NULL, ",");
}
printf("\nSum = %d, average = %f\n", sum, (num==0? 0 : (float)sum/num));
return 0;
}
Hope it helps?
|
|
|
|
|
THANK YOU SO MUCH.. it really helpes...cool...
|
|
|
|