Go Premium for a chance to win a PS4. Enter to Win

x

C

22K

Solutions

13K

Contributors

C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. By design, C provides constructs that map efficiently to typical machine instructions, so it has found lasting use in applications that had formerly been coded in assembly language, including operating systems as well as various application software for computers ranging from supercomputers to embedded systems. It is distinct from C++ (which has its roots in C) and C#, and many later languages have borrowed directly or indirectly from C.

Share tech news, updates, or what's on your mind.

Sign up to Post

I know there are many iPhone/Android insertable "credit card swipers," but those only work with PayPal, Square, or whichever brand that hardware is associated with. So, I need a generic one.

Does anyone know of one or more of these gadgets which can be plugged into a smart phone and configured to be an input device by an iPhone or Android app?

Thanks
0
What does it mean to be "Always On"?
LVL 5
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

So i have a program which filters a file containing "emails" in a single line, i link you to the exercise (it is a pdf) https://training.olinfo.it/#/task/ioit_spam/statement so my problem is that it doesn't accomplish all of the 4 tasks but from my tests (i've created a file with 1000 emails) it should correctly and pass all of its cases. i don't know if it's a problem of the corrector on the site (you need to register to test the program) but i link here the scoring (it should score 100 in theory) it might be a problem of the corrector? https://imgur.com/a/QmeY5 and the source file is this https://pastebin.com/iVPXUjxb
Thanks to everyone answering i hope i've made the question clear, the program works in my machine, it can even scan 10000 emails if i'd want to, infact i've tried filtering a 8mb file containing 1000 emails with 1000 words each.
this is the link for the 1000 emails input file https://drive.google.com/file/d/1f9OWkzZ_i9T8s6BcNIq5hXqBogCR2Dcj/view?usp=sharing
0
Hi,

Can an ASP.NET Core app support reading and writing to an access database? BTW this would be a ASP.Core app running on a Linux host.

https://blogs.msdn.microsoft.com/dotnet/2016/11/09/net-core-data-access/

I assume it cant but wanted to double check in case there is another way.

Thanks,

Ward
0
Hello,
Please help with srv_content_filtering of c-icap-modules 0.4 with Squid 0.5. It is not blocking anything. Is it not working by design or config is not correctly written? Thanks in advance.

Run:
c-icap-client -s srvfilter -resp www -f ./test.html -v -d 10

Open in new window


Config srv_content_filtering.conf:
Service srv_cfg_filter srv_content_filtering.so
ServiceAlias srvfilter srv_content_filtering

srv_content_filtering.Match denyhosts1 url /(sex|porn|www|ru)/i score=10
srv_content_filtering.Match denyhosts1 body /.*/i score=10

srv_content_filtering.Action block score{denyhosts1>1}

LogFormat mySrvContentFiltering "%tl, %>a %im %is %huo  [Scores: %{srv_content_filtering:scores}Sa] [ActionFilter: %{srv_content_filtering:action_filter}Sa] [Action: %{srv_content_filtering:action}Sa]" 
LogFormat myFormat "%tl, %a %im %iu %is %I %O %Ib %Ob %{1000}bph" 

AccessLog /var/log/c-icap/access_.log myFormat

Open in new window


test.html:
<html>
<body>
Test message
<a href="http://sex.ru/">Sex</a>
</body>
</html>

Open in new window

0
I have a C program and when I press ctrl +d right after the program starts, it ends in an infinite loop. Should I press ctrl +d in the course of the program it still gives me an output.

Is there a way to make the program exit without any output when CTRL +D is pressed

This is my code:

         ...
    
       {
            int repeats = 0, counter = 0;
            //Amount of triangles
            repeats = checkInput0();
            int i;
            
            
            // scanf("%d", &repeats);  //num is the user input
            for(i=0; i<repeats; i++)
            {
                //printf("enter first number");
                a_arr[i] = checkInput1();
                //printf("enter first number");
                b_arr[i] = checkInput2();
                //printf("enter first number");
                c_arr[i] = checkInput3();
            }
            
            
            float a_sqrd;
            float b_sqrd;
            float c_sqrd;
            
            
            //     checking if given triangle is valid
            do {
                a = a_arr[counter];
                b = b_arr[counter];
                c = c_arr[counter];
                a_sqrd = a*a;
                b_sqrd = b*b;
                c_sqrd = c*c;
                
                if((a + b > c) && (a + c > b) && (b + c > a))
                {
                    // Checking for special cases of triangle
                    
                    if(a==b && b==c)

Open in new window

0
how can i produce sound or play a music in codeblocks using c language ?
0
Generally, I will be given a set of X/Y points and their corresponding Z values. (Z = f(X, Y).
And those X/Y points are typically fall into a regular grid pattern so that a set of horizontal lines and vertical lines will capture all the points where those lines intersect. (Note: FYI - the distance between parallel lines do not have to be fixed to have regular grids.)

For the above, I can use bicubic spline interpolation algorithms to solve the problem. This approach requires solving for 16 coefficients of a cubic surface in every rectangle; and trying to keep the surface smooth at the end points by keeping the derivatives, fx, fy, and fxy, the same for neighboring rectangles.

a. Then there is a relaxation of this strict rule. It is that the horizontal lines (representing Y values) will be evenly spaced; but that the X values from one horizontal line to the next will not be regular (i.e., vertical lines intersecting the horizontal lines will not always have known X/Y points).

b. Then there is a more general case where the X/Y points are not quite regular. They aren't randomly placed, but they are not regular.
https://en.wikipedia.org/wiki/Multivariate_interpolation

If you can help me understand how to interpolate with either case (a) or (b), I would appreciate the help. One thought I had was to consider a point and look at 4 quadrants, and take the closest point in each quadrant, and using those 4 irregularly place points, try to interpolate. If (a) is a lot …
0
gdb.png
So what I'm trying to figure out is the cmp command. So this is a C program that asks for user input ID and Password and checks to see if it's correct. I'm suppose to change the bytes using C++ so that it'll accept the password that I input. So I want to know if the command cmp 0x74 %al means that it's comparing address at x76 with the bytes %al? I'm not too familiar with assembly code x86.
0
Due to security concerns related to updates not being applied to third-party software libraries, we are trying to replace as many of these as possible with functionality provided by the operating systems and are looking into options with compression. Are there any common compression formats that both Linux and Windows understand and provide C or C++-callable functions to programs to compress to and decompress from using only the APIs provided by the operating systems as installed? Thanks for any information!
0
I am writing a program in C to mimic a simple shell interface however I have a small bug in my code which I cannot figure out. When I run the program in background it starts to execute but when I press enter (instead of prompting me to enter a new command), it goes in an infinite loop which I dont understand why. Can someone please tell me what I am doing wrong here?

Replit link for the program https://repl.it/MrPH/3

/*
Program to mimic linux shell interface
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <string.h>

#define MAX_LINE 80 /* The maximum length command */

int main(void){
  char *args[MAX_LINE/2 + 1]; /* command line arguments */
  int should_run = 1; /* flag to determine when to exit program */
  char user_input[MAX_LINE]; 
  int i = 0;
  int background = 0;
  while(should_run){
    printf("OSH> ");
    fflush(stdout);
    scanf ("%[^\n]%*c", user_input);

    i = 0;
    args[i] = strtok(user_input," ");
    while (args[i] != NULL){
      i++;
      args[i] = strtok(NULL, " ");
    }

    if(strcmp(args[0], "exit") == 0) /* exit command */
      break;

    if(strcmp(args[i-1], "&") == 0){ /* if & is included process running in background*/ 
        args[i-1] = NULL;
        background = 1;
    } 

    pid_t pid; 
    pid = fork(); /* fork child process */
    if(pid < 0){  //if fork failed due to some reason 
        return 1;
    }
    
    if (pid == 0){
        execvp(args[0],args); /* execute the 

Open in new window

0
Technology Partners: We Want Your Opinion!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

When a user performs a system call such as ...  long enc_file(const char *filename, const char *data, long len)

How do you get those arguments inside kernel space?  Basically I have to creat(filename) with *data for as long as len
0
The <Time.h> for MSP430 lack asctime_c() function, is there way to transfer asctime into char data[] instead?    

[code]char date[20];
zprintf("%s\n", asctime(time_info));    

How to put asctime into char data[]

Thanks.
0
How to pass the augument within zprintINFO(.....) to zprintf(.....)

This is for MSP430 and PIC24 code. zpintf is custom printf code to limits code space. I have repeating text INFO


//==================================================================
//==================================================================zprintf
// Purpose  :
// Input    :
// Output   :
// Note     :
//================================================================
void zprintfINFO(char *format, ...)
{
    zprintf(format,...);
}

//==================================================================
//==================================================================zprintf
// Purpose  :
// Input    :
// Output   :
// Note     :
//================================================================
void zprintf(char *format, ...)
{

Open in new window

0
How to insert image or picture in turbo c
Plz me
0
api-ms-win-crt-runtime-l1-1-0.dll
cairo-vs14.dll
croco-0.6-vs14.dll
gdk_pixbuf-2-vs14.dll
gio-2-vs14.dll
glib-2-vs14.dll
gmodule-2-vs14.dll
gobject-2-vs14.dll
libxml2.dll
pango-1-vs14.dll
pangocairo-1-vs14.dll
pangowin32-1-vs14.dll
rsvg-2.0-vs14.dll
vcruntime140.dll
zlib1.dll

I want to merge these dll's into single dll, Please help me
0
A  wonderful new day.

Am wriiting a window service application in C# and its supposed to call  a C programme from its OnStart() function.

My question is this :

(1 ) Can i develop a C WIN32API in Visual Studio 2017, if yes, how can i please.

(2) Starting from the OnStart() function  how  do i call the C application


Thank you
0
Hello ,


Any body knows a sample for re-calculate checksums and drop packets on netfilter module ?

Thank you
0
Hello ,

We are building an IDS/IPS/Waf system that reads the packets from PF_Ring and apply rules to IPTables / Netfilter / Ntuple .
That software needs to access to userspace for iptables and kernelspace for netfilter. So we already pipe the both side.
But our main concern is about the performace issue. Time is our biggest enemy and need to solve the problem in mikro / mili seconds.
So where is the best place working area for our  main core of software for performance ? kernel area or user area ? and why .

Thanks for information
0
Hello ,

I want to know if there is a possible way to apply BPF filter to drop packets on netfilter  


Thank you



#define __KERNEL__
#define MODULE
#include <linux/ip.h>             
#include <linux/kernel.h> 
#include <linux/module.h> 
#include <linux/netdevice.h>      
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h> 
#include <linux/skbuff.h>         
#include <linux/udp.h>      

#include <linux/ip.h>


              
static struct nf_hook_ops netfilter_ops;                        
static unsigned char *ip_address = "\x5D\xBB\xCD\x73"; 
static char *interface = "p1p2";                          
unsigned char *port = "\x00\x17";                       
struct sk_buff *sock_buff;                              
struct udphdr *udp_header;                              
unsigned int main_hook(unsigned int hooknum,
                  struct sk_buff **skb,
                  const struct net_device *in,
                  const struct net_device *out,
                  int (*okfn)(struct sk_buff*))
{
  if(strcmp(in->name,interface) == 0){ return NF_DROP; }  
  struct iphdr* iph = ip_hdr(skb);
  if(iph->saddr == *(unsigned int*)ip_address){ return NF_DROP; }   
        
        
        
	/**sock_buff = *skb;
	if(!sock_buff){ return NF_ACCEPT; }                   
	if(!(iph)){ return NF_ACCEPT; }              
	if(iph->protocol != 17){ return NF_ACCEPT; }                 
	udp_header = (struct udphdr *)(sock_buff->data + (iph->ihl *4)); 
	

Open in new window

0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Hello

Is there any body knows ready to use sub routine when we send an array it will draw sth. like that :

value |-------------------------------------------------- count
    0 |                                                     32167
    1 |                                                      9999
    2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  1723569
    4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@                        973472
    8 |@@@                                                 111055
   16 |                                                     14777
   32 |                                                       376
   64 |                                                       585
  128 |                                                        19
  256 |                                                         0
  512 |                                                         0

Open in new window

0
//************************** tracks indexs*******************
/*
each track saved in sd card has index , so to play track number we will using it's index 
for example to play track number 1 we will using "00003"  index which will send to play track function 
all the same for the rest of all tracks 
*/ 
char buffer15[6]={"00001"};  // track 15 index 
char buffer16[6]={"00002"};  // track 16 index
char buffer1[6]={"00003"};   // track 1 index
char buffer2[6]={"00004"};   // track 2 index
char buffer3[6]={"00005"};   // track 3 index
char buffer4[6]={"00006"};   // track 4 index
char buffer5[6]={"00007"};   // track 5 index
char buffer6[6]={"00008"};   // track 6 index
char buffer7[6]={"00009"};   // track 7 index
char buffer8[6]={"00010"};   // track 8 index
char buffer9[6]={"00011"};   // track 9 index
char buffer10[6]={"00012"};  // track 10 index
char buffer14[6]={"00013"};  // track 14 index

//*************************

Open in new window


How can I access these mp3files via filename not index
0
Hi, new member here and first post. My goal is to create a basic tab control using the Win32 API that contains a canvas for rendering OpenGL. Please see attachment for my source code. I created a tab control with two tabs; the first tab contains a button and the second tab contains the rendering context. The first tab, when active, successfully displays a button. The second tab, when active, does not display the OpenGL canvas. The only way I can get the canvas to appear in the GUI is to exclude the tab control (comment out the CREATE_TAB_PANE macro in my example to do this). I am rendering the OpenGL context within a static control. Thanks in advance for your help.
OpenGlTabWin32.cpp
0
what is c language?what is it's necessity.?
0
Hi,

This is Ravi...

So far I read everything mentioned above...so I request you to provide one end to end example to do the same... because I am completely new to it...
0
I am in the process of moving legacy codes in c to Intel 64 (ksh) from Unix Tru64 (ksh).  
 I created a basic hello world application in c so I could setup the debugger.   INTEL has instructed me to use the gdb-ia debugger.   I don't know where any manuals are to read this for myself.   I have gotten a few errors along the way that have lead me to add the following lines to my ksh users .profile.  
 export LD_LIBRARY_PATH=/opt/intel/debugger_2017/libipt/intel64/lib
 export PYTHONHOME=/usr
 Currently I am getting an error:  $>gdb-ia ImportError: No module named site
 With every question I ask INTEL, it takes me a business day to get an answer.  So, I've had great luck with Experts Exchange in the past, so I'm back to get some direction.  
 My last correspondence with INTEL was:  
      "Looks like you forgot to source the environment."
        "#source /opt/intel/bin/compilervars.sh intel64"

 Where am I going to add this line of code?   The "#source" makes me think it would go into an include file somewhere.   Can anyone see through this and give me some advice???
 I also have another post out there for mapping Tru64 compiler options to INTEL.  

 Thanks everyone for your help!
0

C

22K

Solutions

13K

Contributors

C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. By design, C provides constructs that map efficiently to typical machine instructions, so it has found lasting use in applications that had formerly been coded in assembly language, including operating systems as well as various application software for computers ranging from supercomputers to embedded systems. It is distinct from C++ (which has its roots in C) and C#, and many later languages have borrowed directly or indirectly from C.