Click here to Skip to main content
15,891,184 members
Everything / ANSI

ANSI

ANSI

Great Reads

by ToughDev
How to convert between NSString and C strings in iOS project
by Ajay Vijayvargiya
Many Windows C++ programmers get confused over what bizarre data type identifiers like TCHAR and LPCTSTR are. Here, in brief, I will try to clear out the fog.
by rog_gc
OO Programming with pure ANSI C
by Richard MacCutchan
Recent questions on reading ANSI vs Unicode text prompted the following

Latest Articles

by ToughDev
How to convert between NSString and C strings in iOS project
by rog_gc
OO Programming with pure ANSI C
by Stian Andre Olsen
EncodeText is a small program that can decode and encode text files using any of the codecs supported by Qt
by Ajay Vijayvargiya
Many Windows C++ programmers get confused over what bizarre data type identifiers like TCHAR and LPCTSTR are. Here, in brief, I will try to clear out the fog.

All Articles

Sort by Score

ANSI 

16 Aug 2013 by pasztorpisti
Simple: You have to return two values: an angle and a motor index. Your code also has a bug, max_angle isn't initialized. For two fixed values its an overkill to use a for loop. Using a for loop would be reasonable only if the input angles were in an array. Passing in the motor indices is also a...
12 Aug 2013 by Sergey Alexandrovich Kryukov
It's malloc, please see:http://www.cplusplus.com/forum/articles/416/[^].Please don't forget free.Why do you thing your allocation should be dynamic? You don't have variable number of structures; in your code, it's the immediate constant 4, which is, by the way, always bad. You should...
6 Sep 2013 by OriginalGriff
You can't, not without changes to your function - it returns an integer - the value of the node - rather than the node itself, so the code fragment you show:list_element_at(listo , 2 ) = 50;Is the equivalent of trying to say:17 = 50;Which no modern compiler will allow you to do, for obvious...
6 Sep 2013 by nv3
The solution is simple: You just have to return a reference to data member:int32& list_element_at(llist list, int32 n){ ... return temp->data;Just a single ampersand and you are done :-). Now, what that causes behind the scenes is that the compiler will pass a pointer to the...
12 Aug 2013 by Fredrik Bornander
If my_array must be of type int then that is going to be difficult to achieve. If, however, you can let my_array be of type int* then it can be done like this;#includestruct fresh{ int value;};int main(){ fresh foo[4]; int* my_array[4] = { ...
5 Jul 2015 by Frankie-C
Your programming sample is a very bad example of obfuscated function prone to error and confusion. I suggest you to receed from your intent and consider a more clear alternative, or it will be a nightmare in future revisions.You are abusing of the sequence of translation pointers at beginning...
30 Aug 2011 by André Kraak
When reading the ANSI file in a UNICODE build you first need to read the data into a char buffer and then convert the text into a UNICODE string for further processing.Please note that your code does not handle the possible presence of a BOM (Byte Order Mark) in the file. This article[^] on...
12 Aug 2013 by Maciej Los
Here: 7.2 Passing Arrays to Functions[^] you'll find an example
13 Aug 2013 by The_Inventor
It is pretty obvious that in your code, that you are not showing, that when you calc the torque, you are not saving it to temp_value or don't assign the calculated answer to the temp_value, so the original value of temp_value is still = 0;temp_value = another_function(joint[index]);but it...
13 Aug 2013 by CPallini
Quote:float calculate_torque(motor motor_array[], int index, some input){ float temp_value; //body of the function return temp_value; }You are NOT assigning motor_array[index].member inside the function, so no surprise if it is unchanged.
2 Sep 2013 by OriginalGriff
We don't do your homework - you get the credit, so it's only fair you do the work as well! :laugh:But this isn't difficult:Set up a simple loop to check each array entry to see if it matches.The only complication is that you want to return a variable number of index values - which means...
7 Sep 2013 by KarstenK
a list with indicies is not usual. If you want an index you better use an array. Use some type of template class, so you need not to "reinvent the wheel".
7 Sep 2013 by H.Brydon
If there is a counter in the head object and an index in each node, then removing a node in the middle will cause inconsistency in at least 2 places. There is no way to come up with a situation or algorithm that will fix this. Your program and how you use the data will need to reconcile this...
7 Sep 2013 by mbue
you dont need to adjust the node indexes. use a second chain for freed nodes to recycle the deleted nodes on the next insert operation. or you can merge all deleted nodes on a threshold value (delete count) at once.regards.
8 Sep 2013 by nv3
The method you describe in solution 2 is not an option. You are not allowed to move nodes in memory, because all next pointers will be pointing to the wrong place. A single big memmove would also assume that the remaining nodes in your list are in a contiguous memory block, which they are...
8 Mar 2018 by Richard MacCutchan
See c# - How to call a function from DLL in UWP? - Stack Overflow[^].
14 Nov 2018 by Richard MacCutchan
I just typed "help prompt" at the console and it shows that $_ is interpreted as CRLF.
9 Aug 2019 by Gerry Schmitz
If you're just "streaming", there's no need to be concerned about "encoding". The "text" contains Greek Unicode or it doesn't. Use the correct Font for the range of codes and it will display properly; otherwise not. That's it.
29 Aug 2011 by yeshgowda
Actually I converted my VC .net project from Use Multi-Byte Character Set to Use Unicode Character Set (i.e. Unicode support). Then lot of build errors fixed.Before in my project, I’m reading the ANSI text file as belowCStdioFile l_oStdioFile;CString l_strValue = _T("");TCHAR...
12 Aug 2013 by z3ngew
Hello everyone, if i have declared the following structurestruct fresh{ int value;};and declared the following 2 arrays;int my_array[4] = {50, 70, 800, 30};struct fresh foo[4];i want the values in my_array[i] to be variable and always take the value of foo[i].value even...
14 Aug 2013 by Philippe Mori
You should uses a single array if possible.In some cases, an union or reinterpret_cast can be used but it should generally be avoided in your own code as it can be hard to maintain and cause some subtil bugs if you don't understand all the implications.A typical example where it might...
16 Aug 2013 by z3ngew
Hello everyone,I have a problem here, i designing a function that can move more than 1 rc_servo motor smoothly,but i really have problem here,void Poly_servo_goto(int8 index1, int8 index2, float angle1, float angle2){ int8 i; const int8 motor_count = 2; float max_angle; ...
16 Aug 2013 by z3ngew
i found a solution which works great with me, its idea is to unify the angle_array index and the maximum_output of motor index and then the each angle index represents its belonging motor to drivevoid Poly_servo_goto(int8 index1, int8 index2, float angle1, float angle2){ int8 i; ...
6 Sep 2013 by z3ngew
Hello everyone,I am making a linked list code library,i 've designed a function that return the value of the element at any in range given indexnow i want to know how to make this function set and get without actually passing the new value as a parameter in the functionhere 'is the...
7 Sep 2013 by z3ngew
Hello everyone,if i have a linked list and i want to remove and item, what i should do is first locate the element that need to be removed, and then if it is located in the middle of the chain free it and point its previous to its next.the question is about locating the element, but first...
7 Sep 2013 by z3ngew
I think i have found the solution, after freeing the desired node, i make memmove to the rest of the list to shift (sizeof(struct node)) left, now in order to get element at specific index we can use memory address and discard the index member, for examplethe head is always the first and then...
8 Sep 2013 by User 59241
Others have made very valid points already.You have not provided sufficient information in your question for a rigorous answer. This is a design issue and you have not said anything about how much data you have and why you chose a linked list in your design. This I fear was where your troubles...
26 May 2014 by Naina Dhande
I am a c# developer, want to use the library developed in ASCI C, which is having many folders with c, h and makefile. Can any one help me guide how to use this library from Visual Studio 2008
26 May 2014 by Nivedita_Parihar
Use [DllImport("your_functions.dll", CharSet = CharSet.Auto)]You cannot because you can't statically link unmanaged code(c) into managed code(c#). You will have to write a .dll to wrap all your library functions in C++. Once you do, you can use C# interop functionality to call those...
1 Oct 2014 by bling
For #1 - reading the keyboard buffer even when the program does not have the input focus. Use the GetAsyncKeyState function. You will have to code it in a loop and search all scan codes. Be sure to include a call to Sleep for a few milliseconds between each call to GetAsyncKeyState to prevent...
2 Oct 2014 by bling
Here's an easier solution.Create a C++/CLI project that links to your C library. This completely avoids P/Invokes and DllImport. Getting the DllImport declarations to match actual C functions can be a pain.Define a namespace in the C++ project with public functions. You don't need to...
13 Aug 2015 by Member 11898509
WITH COMMON TABLE EXPRESSION we can do something like this-with t (emp_name, department, rn) as ( select emp_name, department,row_number()over (partition by department order by emp_name) as rn from employee8), c (emp_name, department, rn) as (select emp_name,department,...
8 Mar 2018 by neoxxxooo
I writing a windows app using Universal Windows Platform for GUI. But current the app need to call some functions in a library that is written in ANSI C. What I have tried: I have searched, but I found only for C++ Creating a basic Windows Runtime component in C++ and calling it from...
14 Nov 2018 by ilostmyid2
remember ansi.sys? colorful prompts are not supported anymore! unless with some tools like ansicon. anyway, i need to know how can i go to the beginning of the next line. what is its ansi escape sequence? i need my prompt to be like: path > so that what i type appear from the beginning of the...
12 Aug 2019 by perogr
I read a big txt file with greek characters (in Notepad++ says that is ansi encoding) and I break it in shorter txt files. The most of the files are ansi but some files are not ansi. This is crazy but it happens every time I tried . What I have tried: the code is objStreamReader = New...
12 Aug 2019 by Maciej Los
perogr[^] wrote: The 28597 code page is for iso-8859-7, I think that it is greek ansi. No. A ISO/IEC 8859-7 (Windows-28597)[^] is used for Latin/Greek. A Windows-1253[^] code page is used for Greek-ANSI. Wiki wrote: Windows code page 1253 ("Greek - ANSI"), commonly known by its...
9 Apr 2020 by Mat 257
Hello. I m wondering whether is possible to move the cursor to line up in the screen after printing a string to early one? What I have tried: I found some strings code across the web but no one is working, something like \033 [F.
12 Nov 2022 by PartisanIsaac
I was making a small block drawing package with Node.js, and i was tinkering with it, but at the exact moment i put a ANSI Color code, it started to break. Before: Image[^] After Image[^] The reason that makes it break is that all the...
12 Nov 2022 by Dave Kreskowiak
Quote: The reason that makes it break is that all the characters i use to make the ANSI codes work are being treated as just normal characters when i use the string .length property. That's because, in the terms of a string, they ARE normal...
8 May 2023 by ToughDev
How to convert between NSString and C strings in iOS project
9 Apr 2020 by OriginalGriff
That's going to depend on the system you are using to produce the code, and the framework in which your app runs: a WinForms C++ app will not process ANSI escape seuqences at all for example, and many console based outputs won't either. Even if...
19 Apr 2012 by Ajay Vijayvargiya
Many Windows C++ programmers get confused over what bizarre data type identifiers like TCHAR and LPCTSTR are. Here, in brief, I will try to clear out the fog.
20 Jan 2014 by rog_gc
OO Programming with pure ANSI C
11 Nov 2022 by OriginalGriff
That's because ANSI escape sequences are just that: sequences. They have a common format: They start with an ESC character, and the following character either completes the sequence are indicates a Control Sequence if is is an open square...
11 Feb 2012 by Richard MacCutchan
Recent questions on reading ANSI vs Unicode text prompted the following
13 Jun 2012 by GabeA
I have written code to both setup and read the voltage going to the PICs onboard ADC, and displaying the digital value on an LCD. I ran the code with analog channel 9, and it worked perfectly, displaying the correct value on the LCD. However, when I changed to channel 7, I ran the same code and...
13 Jun 2012 by TRK3
You declared ADCvh as an unsigned char (8 bit value).The last 3 lines of readADC() you shift that 8 bit value by 8: ADCvh = ADCvh>>8; ADCv = ADCvl + ADCvh; return ADCv;Shifting an 8 bit value right by 8 is an undefined operation. A C compiler is allowed to do...
3 Sep 2013 by Stian Andre Olsen
EncodeText is a small program that can decode and encode text files using any of the codecs supported by Qt
12 Aug 2013 by z3ngew
Hello everyone,I have a problem when assigning value to an array of structuresfor example let's declare the following structure;typedef struct{ float member;}motor;now the next step is to declare an array of of type motormotor joint[4];now if i assign member like this there...
29 Jan 2013 by K4Sh!F
Here is what my project does:Language: C++Once the system has successfully logged-in, and this software that I am making is made to run or directly at start-up, if the user incidentally presses any of the pre-defined keys, the following function runs "w" ===> MS Word Document "b" ===>...
1 Sep 2013 by z3ngew
Hello everyone,How can i search for all matching values in an array of integers and then return their indexesThanks in advance,z3ngew
11 Aug 2015 by Member 11898509
I just want to create a query so that it does the same function as listagg in oracle but I dont want to use wm_cocat, lag or lead. My table is-Emp_id - emp_name - department1 - alan - 12 ...
2 Aug 2013 by z3ngew
Hello everyone,I have a question, i am using c language to program PIC micro controller, but i have a problem:i am using multiple compilation programming, so that each code library is composed of header file (.h) and source file (.c), i made an array of functions using typedef typedef...
12 Aug 2013 by z3ngew
Hello everyone,will someone please explain to me how to dynamically allocate and array of structuresfor example this structuretypedef struct{ float angle; //current servo angle unsigned int16 width_count; float min_angle; //min achievable angle float max_angle; ...
12 Aug 2013 by z3ngew
i found a good answer herehttp://cboard.cprogramming.com/cplusplus-programming/80630-passing-struct-function-reference.html[^]
27 Jun 2015 by OriginalGriff
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.Try it yourself, you may find it...
3 Jul 2015 by lukeer
Hello forum,the good news is that this works:// Headertypedef enum{ LanguageId_English = 0, LanguageId_German, // Insert additional languages here LanguageId_Invalid}LanguageIds;// Sourcetypedef union Translation Translation;union Translation{ ...