Questions tagged [char]

char refers to the character data-type, representing letters, digits, punctuation marks, control characters, etc. Use this tag for questions relating to and usage of the character data-type.

char
Filter by
Sorted by
Tagged with
0 votes
1 answer
3k views

Cannot convert from 'TCHAR [260]' to 'std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>

error C2440: 'initializing': cannot convert from 'TCHAR [260]' to 'std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>> I get this error, been stuck on this for a ...
develping's user avatar
-3 votes
2 answers
202 views

translate python code to javascript

I need help to translate this python code to an other language. I would like to convert this python code to javascript: Original code (python) : data = list("\x01\x03\x19 @ \x06\x01\x03\x01\x02\x01\...
Kevin Bergeron's user avatar
-3 votes
1 answer
37 views

remove a letter from a char and reprint the char

main(void) { int p; char n[6]="apple"; char n2[6]="happy"; for(int i=0;i<6;i++) { for (int j=0;j<6;j++) { if(n[i]==n2[j]) // ...
Manju Naidu's user avatar
0 votes
0 answers
25 views

Char variable comparison issue in java [duplicate]

I have a problem try to compare variables char the program do not comppile... will you plase showme the problem... Scanner sc = new Scanner(System.in); double desca=0.05; System.out.println("...
user avatar
2 votes
0 answers
471 views

How to convert 32 bytes char buffer into uint64 in lua?

I am writing a mechanism to generate a unique ID derived from sha256. I use: require 'sha2' function getUint64ID( callId ) local minimumValue = 100000000000000000 local maximumValue = ...
ssk's user avatar
  • 9,175
0 votes
1 answer
649 views

LC 3 program not displaying output

I am trying to write an lc 3 assembly language program that reads in a string and outputs the string. Now I am pretty confused as to why the program wont output anything. I am not sure if my algorithm ...
wissam hammoud's user avatar
2 votes
1 answer
144 views

How to store the character ú in char array with std::cin?

In console the user type several characters including: ú .I would like store these characters in a char array using std::cin, but the character ú is stored as: 163'£', I really want to store it as: ...
Mikerger's user avatar
0 votes
2 answers
259 views

Answer Review - Invalid Conversion from 'const char*' to 'char' [duplicate]

Upon research I actually found the answer to my previous question. Why the heck is the computer telling me I can't define the elements of my array. #include <iostream> using namespace std; ...
Thomas's user avatar
  • 2,804
3 votes
4 answers
4k views

size in bytes of a char number and int number

please tell me if I am wrong, if a number is stored as a character it will contain 1 byte per character of the number(not 4 bytes)? for example if I make an int variable of the number 8 and a char ...
migara's user avatar
  • 55
2 votes
2 answers
128 views

How can a char value be converted to a specific int value

I have an assignment where I have to make a program that allows a person to input a seven letter word and converts it to a telephone number (1-800-PAINTER to 1-800-724-6837 for example). I'm trying ...
Carlos Valeriano's user avatar
0 votes
0 answers
915 views

Can I use scanf multiple times and store the input in the same variable?

I am doing an exercise in which my program needs to output 20 lines of a file and then wait for user input. If the input is the character g, the program should stop executing. Otherwise, it should ...
Areg Sarvazyan's user avatar
-2 votes
1 answer
113 views

C program character array error [duplicate]

So I'm fairly new to the concept of arrays and very new to the concept of functions. Right now I am trying to create a 3 x 3 array with all "_" that can later be modified with other functions. This is ...
ClockwerkSC's user avatar
0 votes
1 answer
756 views

What should char function return in C?

I'd like to know what should char function return? Take this code for example: #include <stdio.h> char *convert(char *str); int main() { char *str[1000]; printf("Enter a string: "); ...
John's user avatar
  • 1
0 votes
0 answers
292 views

What is SQL NULL value converted to for java primitive type char?

What is SQL NULL value converted to for java type char? For example, public class Foo { private char color; } The filed is primitive type, mapped to CHAR(1) in database. When the column is null,...
eastwater's user avatar
  • 5,094
0 votes
0 answers
95 views

Java permutations of char array with repetition

I aim to make a function that generates all possible permutations with repetitions of char array -> for ex. ('a', 'b', 'c' ). After checking if everything is in arraylist allPerms, I found out that ...
David Bulko's user avatar
-2 votes
2 answers
160 views

Unfortunately, my program does not want to replace the newline with the null terminator [duplicate]

I'm currently working with sockets in C, and it seems we can't get the output to buffer correctly. How it works is that a client sends a string to a server in pieces. The server waits until it finds a ...
Gene Tenorlas's user avatar
0 votes
2 answers
422 views

MATLAB char to cell array

I have to following char in Matlab: charList = '{''68'', ''10''}' (I actually don't create this one in Matlab, this is coming from .NET but to make this example I just created it...) Right now I ...
Hannes H.'s user avatar
  • 121
1 vote
1 answer
2k views

Passing Char pointer in C function [duplicate]

I am wondering why the expected output for the below program is not "hai" #include<stdio.h> #include<conio.h> void first(char*); void first(char *s) { printf("%u",s); s="hai"; } int ...
Prasath Shanmugakani's user avatar
-3 votes
1 answer
74 views

How would I use the following in c++...int searchChar(char, string) [closed]

I have a function definition int searchChar(char, string) {/* ... */} I do not know how to use it. I have to return the number of times a char appears in a string. I thought that we are suppose to ...
JeffTheMess's user avatar
0 votes
0 answers
214 views

Android Studio - convert emojis to string

I am programming an android application which makes entries in a mysql-database. An other system, which reads from the db, can display the emojis, but only when they are witten-out as string. That ...
Max's user avatar
  • 67
2 votes
1 answer
96 views

Char length is greater than the real length

I'm loading data in a MySQL database, but I've a problem, I have just loaded all data but the field Buyer is working bad: SELECT CHAR_length(TRIM(BUYER)) AS L, BUYER FROM ST_REQ And the result is: ...
Ivan Santiago Armijos Arévalo's user avatar
2 votes
2 answers
227 views

C null terminated strings in HP OpenVMS Pascal

I have a rather simple Pascal program, that is to call some C functions I have written. My C code: void connect_default(int* errorcode) { // Connects the default user and places any error code ...
Helena's user avatar
  • 1,067
0 votes
2 answers
15k views

How to see if two char variables equal to each other

#include <iostream> using namespace std; I want the user to input two char sequences (such as adc and abd) and the program will tell them that the characters are equal as a whole or not.(the ...
CoffeeWaterController's user avatar
1 vote
4 answers
3k views

Pulling a single char from a string and converting it to int

I am trying to pull a specific char from a string and convert it to an int. I have tried the following code, but I am unclear why it doesn't work nor can I find a way to do the conversion. int value =...
MTurek's user avatar
  • 43
-2 votes
1 answer
237 views

Reading char sent from wireless transmitter and creating switch case

I'm trying to transmit a char wirelessly and have the receiver read that char through serial in order to create a switch statement. When trying to convert into int, I get the same int value no matter ...
Mars's user avatar
  • 1
1 vote
1 answer
277 views

My char array in my c++ program will not print anything

I am doing my first C++ program for my class. I am really new to this program so I have a lot to learn. In my program I am suppose to create a Student class with Undergrad/grad/gradassist derived ...
Brody Gore's user avatar
1 vote
2 answers
553 views

Matching letters to word(Unity3D)

I wrote a method in unity but I think it is wrong. I want to do if some sorted letters matching to any word, then it will say true. I mean 10 columns and 20 rows char array. the method will check the ...
freedom667's user avatar
1 vote
1 answer
634 views

Storing Volatile Chars in an Array

Disclaimer: I'm quite new to C and to programming in general so this question may show a lack of basic knowledge. I'm trying to store a set of temperature readings of type 'volatile char' in an array....
Rachel Fallow's user avatar
0 votes
4 answers
106 views

c++ string can't accept new chars if not defined a minimum

I'm aware that the following code #include <iostream> #include <string> int main() { std::string s; s[0] = 'a'; s[1] = 'b'; } says "string subscript out of range" even though std::...
Powereleven 's user avatar
4 votes
1 answer
94 views

Bizarre program behavior about 'char'

I'm writing this code just for fun while learning the if-else statements. There is a weird behavior when I digit 10e, the program returns the error, but I can't understand why! I mean with the other ...
Ernesto Campese's user avatar
0 votes
1 answer
2k views

Stack smashing in C on function return

I have a small program which converts 12 hour time to 24 hour time. #include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #...
Abhishek Jain's user avatar
0 votes
2 answers
238 views

Removing elements of a string vector with certain char requirements

I am currently writing a program that is composed of a string vector full of words that have a certain letter all in the same position. For example my vector might look like this: vector<string&...
John Larkos's user avatar
-1 votes
1 answer
75 views

Program not giving hex value?

My program is giving the right value for Decimal but I'm using char to gt values for Hex Can someone see my code and tell me why my Output is simply a "?" (Attached my output as image) I know you ...
Muhammad Shaeel Abbas's user avatar
2 votes
3 answers
2k views

Comparing with more than one char in C++

Say I have an input that is stored in a char c, and in a conditional I need to check whether it is either of two different characters, for example 'n' and 'N'. It's obvious that I can make a ...
Daniel's user avatar
  • 530
0 votes
0 answers
24 views

c++ custom string class failed to output objects inside vector [duplicate]

I'm trying to implement custom String class and I'm failing at console output, I have the following code: class MyString { public: MyString() { _length = 0; _str = new char[0]; ...
user avatar
-3 votes
2 answers
156 views

Removing a single char from a string of letters based on a number position in JAVA [duplicate]

To give some context to the title, let's say I have an array of INTs. So, for example (1,2,3,4,5). Each number in the array represents a char in a string. So if the string is hello then array[3] is ...
Zealot's user avatar
  • 11
1 vote
2 answers
2k views

Comparing a string and a char c#

I am working on a console Hangman game in c#. I am trying to compare user inputted letter against the letters in the random word I have generated. Error i get is "Operator "==" cannot be applied to ...
estevaano's user avatar
3 votes
3 answers
384 views

How to access a character in a character array

#include< stdio.h> int main() { char *name[] = { "hello" , "world" , "helloworld" }; /* character array */ printf("%s", (*(name+2)+7)); return 0; } The above code prints ...
Prayas Bansal's user avatar
0 votes
2 answers
407 views

Char vs unsigned char in conversion to int [duplicate]

I stumbled upon this problem while saving an int in a char array and converting it back. I used bit shifts and logic or, but my result ended up with all the bytes after the least significant as 0xFF. ...
Maldus's user avatar
  • 11.2k
0 votes
1 answer
3k views

Printing Ascii Art letters in console

i have some problems with making this program. What i need to do is for a project in my class. what i need to do is similar to this: http://patorjk.com/software/taag/ I can print one letter a time ...
Gabriel Emanuel's user avatar
-1 votes
4 answers
414 views

Split a string on 4 Numbers

Given a string, for example,... 1-23-4567 Apple Sauce I'm trying to figure out how to split that into 1-23-4567 Apple Sauce My idea is to somehow split based on the 4 numbers at the end of the ...
Bob's user avatar
  • 1,374
1 vote
2 answers
776 views

How compiler behaves on out of range char value?

char ch = 1107; printf("ch = %c", ch); Above code prints S. I do not get how this happens. I am giving an out of range value for char type. How compiler gets this value "S" (ASCII 83)?
Lyrk's user avatar
  • 1,968
0 votes
4 answers
52 views

Cant remove all chars from a string before a "special one"

I tried coding a complete decimal to binary converter, which worked just fine and now I want to remove the unnecessary 0s from my output String, but it doesnt remove all of the 0s and I have no idea ...
Foka's user avatar
  • 3
0 votes
1 answer
1k views

static_cast use to convert int to char

I have written this code to convert Decimal to binary: string Solution::findDigitsInBinary(int A) { if(A == 0 ) return "0" ; else { string bin = ""; while(A > 0) { int rem = (A % 2); ...
Mohit Sharma's user avatar
-1 votes
2 answers
815 views

char concat c++ no library functions

How to concatenate two char* but without the library functions, I want to get a better insight on how this function works. S1 = "AA" S2 = "BB" The function should return a pointer to "AABB"; This ...
Kelvijn's user avatar
  • 179
0 votes
1 answer
816 views

C++ injector with user input

I have made a simple DLL injector that works fine (x64). But when I tried to upgrade it so the user can pick the name of the dll file through std::cin i haven't found a method that works. Either I get ...
Johnny Code's user avatar
0 votes
0 answers
110 views

How to identify the actual Unicode characters from the bytes when reading a UTF-8 file using Ascii decoding

I'm reading a UTF-8 file using fread() - reference. The file can contain some Unicode characters. I want to identify cases where some specific characters were in the file. For example, I chose ✇ (...
Mugen's user avatar
  • 8,803
0 votes
1 answer
332 views

Haskell, splitting a list into specified chunks causing infinite loop

How can I stop Haskell from infinity performing the function? splitList i "" = [] splitList i str = let (x, y) = splitAt i str in x : splitList i x
Mike Noel Higgs's user avatar
1 vote
4 answers
585 views

Swap chars or strings in data.frame [duplicate]

I have a data.frame with column of Sex: Name <- c("Alex", "Lilly", "Mark", "Oliver", "Martha", "Lucas", "Caroline") Age <- c(25, 31, 23, 52, 76, 49, 26) Height <- c(177, 163, 190, 179, 163, ...
Babai I.'s user avatar
1 vote
2 answers
370 views

How to use call by reference to get value of a char** type variable from a function in C++?

I am trying to print the following using the code as: int main() { char p[] = "hello"; char*t = p; char**b = &t; std::string s = b[0]; cout<<"string="...
user3552519's user avatar

1
85 86
87
88 89
272