I want to write a C++ function in C#:
the C++ code:
#define deleter "/.:_-";
char code[25]; // SR2342-23422-234234 - int take_mod(char *number,int anz,int position)
-
{
-
int k=0,n=0;
-
-
while (zahl[n]!=0)
-
{
-
k=(int)number[n];
-
#ifdef blank
-
if ((strchr(deleter,k) !=0) || (!isdigit(number[n])))
-
{
-
#ifdef delete_blank
-
strcpy(number+n,number+n+1);
-
#else
-
n++;
-
#endif
-
continue;
-
}
-
}
C# code: - public int take_mod(string number, int anz, int position) {
-
int i = 0, k = 0, n = 0 , u = 0;
-
char numberValue;
-
-
while (number[n] != 0) {
-
k = number[n];
-
numberValue= number[n];
-
#if deleter
-
if ((number.IndexOf(deleter[u]) != 0) || (!Char.IsDigit(numberValue))) {
-
#if delet_blanks
-
number = number[n + 1].ToString();
-
#else
-
n++;
-
u++; // u ++ ?????????????
-
#endif
-
continue;
-
}
-
#endif
-
}
I want to run the 24 x characters (SR2342-23422-234234) and delete the alphanumerics and blanks.
thx?
0 2370 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Frank Rachel |
last post by:
So I can focus on the correct areas of research, I was wondering if someone
could give me the .NET equivelents for this J2EE architecture:
JSP's make calls to local JavaBean Controls. The controls do a JNDI lookup
to invoke methods on EJB's. The EJB's use local Java classes, and these
classes use JDBC to do database work.
Example:
Login.jsp contains "import xxx.LoginControl", and invokes the "login"
|
by: Paul Sheer |
last post by:
I need to automatically search and replace all fixed size
buffer strcpy's with strncpy's (or better yet, strlcpy's)
as a security and stability audit. The code base is large
and it is not feasable to manually perform these changes.
I would like perhaps a C++ parser that can automatically
detect use of a strcpy to a buffer of fixed size. For instance,
struct x {
char member;
|
by: Jon |
last post by:
For the past month I have been porting a DirectX windows game to libSDL
on linux, for right now I am working on the basic syntax of the game
engine, I was having problems with opening, reading, and closeing of
directories, I have fixed that though...who woulda thought that it would
be open, read, and closedir()?
Anyway, I am still working on the syntax, and I have been getting these
errors when I compile:
UEngine.cpp: In member...
|
by: ios |
last post by:
Hi
Can someone tell me what is different between below case?
strcpy(eventname, "MDCX_RSP");
and
sprintf(eventname, "MDCX_RSP");
Thanks,
Leon
|
by: Lee |
last post by:
Hi
Whenever I use the gets() function, the gnu c compiler gives a
warning that it is dangerous to use gets(). Is this due to the
possibility of array overflow? Is it correct that the program flow can
be altered by giving some specific calculated inputs to gets()? How
could anyone do so once the executable binary have been generated? I
have heard many of the security problems and other bugs are due to
array overflows.
| |
by: Jake Thompson |
last post by:
I need to copy a value into a char * field.
I am currently doing this
strcpy(cm8link.type,"13");
but I get an error of
error C2664: 'strcpy' : cannot convert parameter 1 from 'const char' to
'char *'
|
by: Snis Pilbor |
last post by:
Whats the point of making functions which take arguments of a form like
"const char *x"? It appears that this has no effect on the function
actually working and doing its job, ie, if the function doesn't write
to x, then it doesnt seem like the compiler could care less whether I
specify the const part. Quite the opposite, if one uses const
liberally and then later goes back and changes the functions, headaches
will inevitably occur as...
|
by: chikito.chikito |
last post by:
1. Can someone tell me the difference between these two functions:
void strcpy(char *s1, const char *s2)
{
while(*s1++ = *s2++)
;
}
//function prototype of strcpy follows
char *strcpy(char *s1, const char *s2) // library function
|
by: sam |
last post by:
HI,
Whats the meaning of this code:-
char buff;
memset(buff, 'A' , 100);
sometimes we can place hex value in
place of 'A' like 0x90c
but how this code function actually.
thanks in advance
|
by: arnuld |
last post by:
I have created my own implementation of strcpy library function. I would
like to have comments for improvements:
/* My version of "strcpy - a C Library Function */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |