Thanks AndrewHunter your example works.
Strange though all I changed was this:
struct tm* tm = localtime(&now);
tm->tm_mday += numDays;
mktime(tm);
To this:
Type: Posts; User: acidblue
Thanks AndrewHunter your example works.
Strange though all I changed was this:
struct tm* tm = localtime(&now);
tm->tm_mday += numDays;
mktime(tm);
To this:
I've tried:
cout << mktime(tm);
But that gives the same results
So far I have this bit of code for adding number of days to a date using the time.h module:
int main(int argc, char **argv)
{
int numDays;
printf ("Enter number of days to add ");
scanf...
Thanks, that's so much easier.
Unbuntu 10.04 Geany IDE
I have a sort of a unique problem.
I want to write to a text file using user input with a char array.
But if the user doesn't write the exact number of characters for the...
Thanks,
Funny after taking one more look at my code I saw the semi colon in the if statement.
I came to edit my post and saw your responses.
That appears to have worked, code runs fine now....
This is driving me nuts.
I am following this tutorial: C Strings - C++ Tutorial - Cprogramming.com
Program compiled fine it just doesn't do what it should.
It won't give the correct number of...
Damn! that was easy.
What about copying different file types.
system("copy \"c:\\Documents and Settings\\%USERNAME%\\My Documents\\*.txt\" "\\*.jpg\ c\\"
I new I had it wrong, just needed some one like you to show me the light :)
That totally works now.
Now on to the second part of my quest.
What if I don't know the user name, is there some way...
Not sure what you're saying quzah, the path is in quotes.
system("copy \ "c:\\Documents and Settings\\rocko\\My Documents\\*.txt c:\\"");
Yes, I put the code into my program and ran it.
That part of the program runs fine, returns list of 5 txt files.
system("dir \"c:\\Documents and Settings\\my_user_name\\My Documents\\*.txt\"");
Funny, that works, I have 5 txt files in that folder.
But I still get the "file not located" error when it tries...
Hi There!
I'm trying to copy all the txt files in a directory and move to another directory.
But I keep getting "System cannot locate file" error.
Here is my code:
#include <stdio.h>
#include...
Why thank you.
Yeah I spotted that after taking a second, a third and even a fourth look.
Yes it sure would.
I totally forgot the scanf() function.
Thanks.
Now if i could could figure out why I'm getting a segmentation fault that would br great.
Time to break out KDbg.
The switch/case part of the function doesn't execute.
Is this because the function returns no value/has no parameters?
Tried adding the 'userResponse' variable as a parameter but that
didn't...
Thanks..
I got it working correctly now.
oh damn I don't believe I overlooked that, thanks.
But after re-compiling it still doesn't iterate to the next bit of code .
Another simple one that's got me stumped.
This compiles fine with out error's but when I run it, it never get's
passed the "How many questions would you like?" .
When I input a number it...
DOH!
I new it was something simple.
thanks.
I'm making a simple roll the dice game that displays your the winner if you roll a 7 or 11.
But my 'OR' operator doesn't seem to be working.
It always displays your the winner regardless the roll...
AHA! I knew it.
Complete noob mistakes.
Thanks for the help guys.
Everything is cool now.
Hi there!
This is my first post and I'm a complete noob to C, so
please bare with me.
I'm having an awful time trying to do true division.
All my variables are int type but my result comes out...