This is what I did and it worked. Thanks all. Learned a lot with this thread.
Type: Posts; User: NewbGuy
This is what I did and it worked. Thanks all. Learned a lot with this thread.
Ah! Thanks guys. That would make sense. If the char is signed, and it's a negative number, then a bit shift converts the char to an int, and fills up the most significant byte with 1's, so that when...
They are 01000000 and 00010100. Then they are OR'd together, which should produce 01010100, then that should be moved into p
signed char n = -94;
unsigned char p;
p = (n >>3) | (n << (8-3));
putc(p);
Signed char n is -94, which is 10100010
After doing a bit rotate, it should be 01010100, which is then put into...
Yeah that was the problem. Thank you!
I have a function that is returning a string that looks like this:
char* getstring(char choice)
{
does some stuff...
return(mystring);
Is that the drop down beside the green play button on the main menu? It says debug already.
Hi I am trying to do something which should be very simple yet I can't get it to work.
I have visual studio 2005 here, and I am trying to use breakpoints in my program.
I put some breakpoints...
Can someone tell me why this doesn't work? It is supposed to simply get a character press from the user and if that character isn't equal to A, B or C, it should print "Error! Enter again!". When I...
Ok for the most part, I have solved the problem of the user entering longer numbers than i wanted, but I still have a problem with the user entering the wrong type of data.
If I ask for a decimal...
I am writing a pretty simple program.
There are a few different inputs I need to get from the user.
1) Single character.
I am using getchar() for this, and it works well, but I've noticed...
strstr returns a pointer to the position of the word in the string. After I have this pointer, do I then use that pointer in a for loop and count the number of spaces from the pointer until the end...
If I had a string, say: "This is a string"
How would I search for a particular word or character and get it's position into an integer?
For instance, say I wanted to get the position of "a",...
Anyone?
Are you referring to using fgetc instead of fscanf? Won't fgetc only get one character at a time? Including all of the spaces and returning a char instead of an int? Because I need to do math on...
I have a text file with one column of numbers. Eventually these numbers need to be added, averaged etc...but for right now I'm just trying to read them in, then print them out. My main problem is...
I was wondering if someone could point me in the right direction here.
A pointer to a string is passed into a function, the string contains a few different words and numbers separated by spaces....
Thank you that works. One problem though, what if there were two numbers in that sentance? ie: "Parts contained in the box are 893 and 398 in box B" and I just wanted the second number?
Is there something to just change it into an int? I just need to do basic addition/subtraction. Also, if I know the number's position in the string, how do I use strtol knowing the number's position...
I am trying to pull a portion of a string out and turn it into an integer so that I can do some calculations with the value, but I can't figure out how to do this for the life of me. Can anyone point...