You can't do it with scanf alone. A common way to pre process input is to read stdin using fgets, scan the buffer for the expected characters, then call sscanf to put the input into the proper...
Type: Posts; User: Rog
You can't do it with scanf alone. A common way to pre process input is to read stdin using fgets, scan the buffer for the expected characters, then call sscanf to put the input into the proper...
remove the '&' from the scanf. With scanf you don't take the address when arg 2 is an array. Also in the fopen remove the double quotes and '*' from filename. You need to add something like:
...
On windows you can use the Win32 console API functions to use color. Don't waste time with trivial tasks like colored text. Instead try to tackle some real programming problems. Learn how to...
It doesn't do that by default... check your process creation flags and startupinfo structure and make the required changes. All parameters are fully explained in the Platform SDK.
-Rog
Usually you can use a response file. List the options for the linker and you should see something like '@response file'. Put all the options and parameters into the response file and pass it on the...
When I am doing MFC programming (as opposed to API programming) I always use CString. It is an efficent class in terms of memory management, and all the string manipulation and conversion functions...
You can actually get away with very little formal C++ OOP knowledge. IMO, that is one of the down sides. MFC has been criticized often because it disregards many of the conventions of object...
MFC will save you a ton of time over straight API. It does similar for C++ what VB does for BASIC. The learning curve is a bit steep at first. Check out codeproject dot com.
Excuse me if I was vague. :) Too many late nights has that effect on me. ;)
Forget the stuff I told you... those are old C language ways of validating input. You can do it very easily in C++...
Hmmm... good point. though the ios_base was in response to a different question from a different poster.
edit #1: fixed misspelled word
If you want to stay away from .NET you will need to get the Software Developers Kit for Windows Mobile based Pocket PCs. The SDK gives you everything you need to write programs in C++
Search on...
use isdigit() to check firstnum[0] thru firstnum[strlen(firstnum)-1] in a for loop. Tip: watch out for '\n' characters at end of input.
another way is to read the input using fgets() to read...
If I was going to write for a PDA running windows I would start looking at the .NET stuff. C++ is powerful, but it tends to be time consuming for the programmer. C# will allow you to knock out...
Sure, you could use state flags to test for eof. I believe it is ios_base::eofbit. You can read the flags directly and do bitwise comparisons, though I prefer to use the built in functions...
...
This is what you need to do:
1)create a buffer to store one line of text from the file
2)open the file for reading
3) test the stream to make sure it is open
4) read one line from the file
5)...
current should be and int.
Interesting. I like the way you utilize the standard library. The insert could represent undesired overhead (not in this little exercise, of course) , but that would depend on how the class was...
COOL! :D
But it isn't formatted and justified like mine is... I mean, mine is definitely easier to read. How would you filter the output from bitset to formate it like mine? (no leading zeros...
I was looking at the other things on this site and noticed the challenges. The dectobin problem looked easy so I jumped on it... it took me no more than two minutes to get the basic algorithm...
And that's why I replied when I saw that you had it wrong. ;)
Your method of using a pointer to char does not make the code portable. Your pointer arithmetic is accomplishing essentially the...
The problem with doing it that way is you have to get it right depending on the platform. Since this is a DOS compiler it's reasonable to assume it will run on an x86 machine ("Little Endian"). ...
I might as well tell you this now, because you're going to learn it soon enough. A programmer needs to be very resourceful and self starting. You won't get much sympathy if you take an "I want...
Why do you need this function anyway? It is a throwback to the days of DOS. I suggest you concentrate on the event driven paradigms present in modern Windows and Linux development. The basics are...
That is an unusual problem that you are having with the installation... though I have seen similar things happen with MS software in the past. It sounds like something is amiss with the registry. ...
foo;
is same as:
&foo[0];
address of second array element is then:
&foo[1];