[Solved] How to count the number of characters in a line in a csv file

I suggest you to read the javadoc of String.split. I think that you misunderstood the concept when you did this: String[] f=line.split(“,”); a[count]=Integer.parseInt(f[2]); //–> java.lang.NumberFormatException here! Avoid using ‘magic’ numbers in your code like int[] a = new int[24];. Why 24? Well, here comes a version that do what you want to do. Maybe it … Read more

[Solved] Convert binary, octal, decimal and hexadecimal values between each other in BASH / Shell [duplicate]

Convert binary, octal, decimal and hexadecimal values between each other in BASH with bc and printf Some relevant Q&A: Understand “ibase” and “obase” in case of conversions with bc? TL;DR: ibase and obase params order matters, but not always. Hex values must be in UPPERCASE. Convert a character from and to its decimal, binary, octal, … Read more

[Solved] Invert 7th bit of hex string C++ [duplicate]

#include <stdio.h> void flipme(char *buf, const char *inBuf) { int x; sscanf(inBuf, “%x”, &x); x ^= 1 << 17; sprintf(buf, “%06X”, x); } int main(void) { char buf[16]; flipme(buf, “002A05”); printf(“002A05->%s\n”, buf); flipme(buf, “ABCDEF”); printf(“ABCDEF->%s\n”, buf); } Output: 002A05->022A05 ABCDEF->A9CDEF You wrote: I tried converting hex string to integer via strtol, but that function strip … Read more

[Solved] How to inverse an integer in C?

Technically, no. But why are you using htons? It changes the endianess of a 16 bit datum to big-endian (that is, network byte order). First is your variable not 16 bit but 32 bit, so uint16_t acc = 0xBBD1 would be more appropriate. Second, as your on a little-endian machine, the bytes are exchanged, hence … Read more

[Solved] How can I find the language of this code and how can I find the tool to convert this code to text or HTML [closed]

They seem to be HTML entities, but they are not complete, they should end with ‘;’ So the code should read: &#1112;&#965;&#1109;t The characters you see are: &amp;#1112; CYRILLIC SMALL LETTER JE &amp;#965; GREEK SMALL YPSILON &amp;#1109; CYRILLIC SMALL LETTER DZE t a normal t In your browser it look almost like ‘just’ For a … Read more