How do I write the MAC address ff:ff:ff:ff:ff:ff as a char[] in C?
Do I just do char macaddress[6] = "%0xFF%0xFF%0xFF%0xFF%0xFF%0xFF";
I'm not sure. Thanks!
|
in a file, i have used m-x ucs-insert to insert a hex character 9e (which in emacs shows up as \236). however, when this is read in by the C program, ... |
When browsing the source of a project on web I've found some weird to me return statement in main:
int main()
{
/* ... */
return 0x1;
}
So ... |
I am trying to set the special characters for a serial port in a C program. I am able to find all of the hex codes except the code for ^? ... |
This might be very basic or even silly to experts here but I wanted to get my head around this. Most of the times I generally write hex values like this ... |
I have a C code during which I open a file to input a hexadecimal number. Then I want to add the number obtained it to another single digit hexadecimal and ... |
i am trying to scan an input file with such format
r1 = 0c100009
So far I have tried this but the while loop is skipped and the output is 0.
...
|
|
I need to send a Hex value 0x5500ff09f6 through UART , can any one please provide me the solution how to send long hex values. Please share your ideas. i m ... |
this is not simple as modern compilers optimise code for size and/or efficency so often the code generated by the compiler does not appear to have a one to one relationship with the C source. In the past I have done this conversion by looking at PIC18 and PIC24 ASM programs to get the general structure and in particular the bit ... |
|
|
Summu82 wrote:[color=blue] > Hi i have to write some data in a binary file > > fputc(0x22,f2); > > this works fine > > also > int data =0x22; > > fputc(0x22,f2); > works fine > > but > int data; > data =0x22; > fputc(0x22,f2); > gives error >[/color] You'd better ask the question again with the correct code and ... |
Consider the little program below. It simply attempts to determine what version of what compiler it was built with via documented preprocessor macros and print out the result. When the compiler is gcc it works fine, because __VERSION__ is supplied as a string. But identifying the Sun compiler is harder because it provides __SUNPRO_C as a numerical value (equal in my ... |
|
I'm trying to make a for loop for hex... I had the code below but I would figure it would be less confusing with a for loop but I"m having trouble geeing it to work right Code: hexStr[i] = '0'; hexStr[8]=0;//Terminating null andResult = value & mask;// masked off all but 4 lowest bits hexStr[7] = lut[andResult]; value = value >> ... |
|
|
Simply put, if you want to describe bits (binary digits), hex is excellent, e.g. 2^10 = 0x400 = 1024 - they all become exactly the same for the computer 0010 0000 0000 is the binary value. If you want to say one thousand, then 0x3E8 is just cryptic. But if you want to know which bits are set in a "random" ... |
#include #include #include #include int main(int argc, char *argv[]) { struct stat fbuf; FILE *dump; int i; int x = 0; unsigned int size; if(argc<2) { puts("Format: HEXDUMP filename"); exit(0); } dump = fopen(argv[1],"rb"); if(dump == NULL) { printf("Error opening %s.",argv[1]); exit(0); } size = stat(argv[1],&fbuf); size = fbuf.st_size; while(i=fgetc(dump), size != 0) { printf("%0.2X ",i); x++; ... |
20. hex math cboard.cprogramming.com |
21. Hex cboard.cprogramming.com |
Hi, just having trouble with my hex adder. It will have to do several things first of which is to add two hex numbers together. It is read in with scanf as you will see below then I am going to use several if statements to achive the different functions of my adder. However i have run into a problem or ... |
Ive written a short and simple DOS General C program (Dev-C++) to lsit the files in my working directory, then read and print out the hex of any file name entered (it takes the file entered, reads the actual file). Now, the line number is listed in hex perfectly fine, but the hex of the string on that line is the ... |
i have a bunch of data coming into my system that is in hex format. to test my program, i put in an exact example of an input into the array it will be assigned to but came up with a bunch of errors, Code: unsigned char Hex_array[BUFFSIZ] =unsigned char Hex_array[BUFFSIZ]= "#RAWWAASFRAMEA,COM1,9,68.0,SATTIME,1263,248186.000,000000000,58e4,1522,22,122,62,563456345dba43623443efdaef3245345fea325345626634623623c000,22*d04567cde"; errors: Code: rubbish.cpp C:\Documents and Settings\shss.GRUPOGMV\My Documents\C Stuff\decoding\rubbish.cpp(18) : ... |
25. Hex Questions cboard.cprogramming.com |
I need to make a counter using hex I want an array of length 10 to be updated each cycle with the next hex number. So the array would start with: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 ... 0 0 0 0 0 0 0 0 0 ... |
27. Hex? cboard.cprogramming.com |
28. Hex distance cboard.cprogramming.com |
29. hex grid cboard.cprogramming.comHi there, I have a hex grid that grows in a spiral and am trying to figure out how to assign (x,y) values to a hexagon. / \__/ \__/ \__/ \__/ \__/ \ \__/ \__/ \__/41\__/ \__/ \__/ / \__/.. \__/40\__/42\__/ \__/ \ \__/62\__/39\__/22\__/43\__/ \__/ / \__/38\__/21\__/23\__/44\__/ \ \__/61\__/20\__/ 9 \__/24\__/45\__/ / \__/37\__/ 8 \__/10\__/25\__/ \ \__/60\__/19\__/ 2 \__/11\__/46\__/ / \__/36\__/ ... |
Like QuestionC says, it's just matter of protocol. In other words, it's a matter of how you define which bit is on which place. As I understand you have a 64 bit value. Let's define that the value is defined as follows (in bits): b63 b62 ...... b1 b0 This can be grouped in bytes as follows: B7 B6 ... B1 ... |
31. Hex cboard.cprogramming.com |
hi guys... im trying to read a .txt file from c drive, that file contains all hex values....line this 20 F8 C1 1E 06 EC 95 F4 F8 7E 68 00 F8 61 68 00 20 00 69 77 0B 00 20 FF 69 77 16 00 74 F0 F3 1F 74 F0 F9 1F 00 77 00 00 26 77 ... |
The key to parsing is knowing how to extract the data based on the data around it. You have not provided any sort of indication to let us know how you came to determine that the data you have highlighted is that which you need to extract. Therefore, it's next to impossible to help you without more information. |
|
I've run in to a bit of a problem streaming data from a file. I'm using I/O manipulators (or setting them the long way, it makes no diffrence). If the hex value to be read starts with a digit, no problem. If it starts with a-f it ends up with unpredictable results. long timestamp; long address1, address2; inData >> dec >> ... |
hi, I am having a small problem with hexadcimals...... Code: unsigned char query[8]; unsigned char offset_hi; unsigned char offset_lo; unsigned char crc_hi; unsigned char crc_lo; unsigned char numreg_hi; unsigned char numreg_lo; . . . query[0] = slave; //slave is int query[1] = function; //function is int and value is 3 query[2] = offset_hi; /* base address of register table Hi byte ... |
Hi all. Bit of a newbie question... Can someone give me the Readers Digest version of how to store floats/ints as hex... Is it simply stroring a number (say 65325) by pairing up numbers as a hex value? i.e. 0x06 0x53 0x25. This is all I've been able to find on the subject so far but, I'm curious as to how ... |
#include #include #include #define SIZE 120 int main () { FILE* fp; char str[SIZE][SIZE] = {{'\0'}}; char* filename = "words.txt"; char test[SIZE]; char *ptr; int i, len; int r=0; printf("\n\n"); if (!(fp = fopen(filename,"r"))) { printf("\nCannot open %s for output.\n",filename); return 1; } ptr = NULL; len = r = 0; while(fgets(test,SIZE,fp) != NULL) { ptr=strtok(test, " "); ... |
I am writing some code to talk to a device via a serial port. I am testing my program by using a loopback, so I can see that what I send is correct. I am sending an unsigned hex array, and when I display the values (before they are sent), they are fine. However, when the array comes back, values over ... |
|
|
|
Hi all,having a string containing 4 hex digits, I need a function that returns the next hex value excluding 'A's. For example:string = "1999" ==> next value = "199B". This is what i have so far: CODE #include #include #include /* returns the next hex value excluding 'A's */char *next_code (char *code)/* code is guaranteed to point to a string containing ... |
|