[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More







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

Error messageHello Everyone,
I hope you all are doing well.  Attached, I have a Visual C ++ error message that a user got when he was at a work training.  He claims that other people were able to use it just fine.  I am waiting to hear back to see if there is anything different with their computers as compared to his.  The program is contained in a folder with a bunch of system files that application calls upon, it is not installed on the computer itself.  I and another tech got a copy of this folder and we get the same error message.  We are going to play around with it and see if we can make this work somehow.  I am just wondering if anyone knows about this.  
The user's computer is running Windows 7 pro
My computer is running Server 2016 Datacenter
my co-worker's computer is running Windows 10 pro

 If you guys think it an issue with the software itself, please let me know.  Any kind of programing fixes that people give me, I will not understand as I am not a software developer and if the fix comes down to that I will simply say that the developers need to fix this.

Thank you guys!!!
Starting with Angular 5
LVL 12
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

I have this bit of C Code for a project I working on for a project.  
logit("Username: %s Password: %s", authctxt->user, password);

Open in new window

This is going to be used in a proof of concept project and I want to obscure the real password.  I was thinking of either replacing the whole password with a set of characters or maybe keeping the first and last two characters and replacing the rest with a set of characters.  Maybe Xs.   Looking for suggested modification.
Hey all I am having the hardest time trying to figure out how to go about the order of decryption the encrypted text.

This is my sketch code:

#include "AES.h"
#include "base64.h"

AES aes;

void gen_iv(byte  *iv) {
    for (int i = 0 ; i < N_BLOCK ; i++ ) {
        iv[i]= (byte) *(volatile uint8_t *)0x3FF20E44;

void setup() {

    char b64data[2000];
    byte cipher[1000];
    byte iv [N_BLOCK];
    char *encodedFinal;

    Serial.println("Let's encrypt:");

    byte *key = (unsigned char*)"5TGB&YHN7UJM(IK<";
    byte *my_iv = (unsigned char*)"!QAZ2WSX#EDC4RFV";
    char *msg = "{\"data\":{\"value\":300}, \"SEQN\":700 , \"msg\":\"IT WORKS!!\" }";

    //Set the key for AES
    aes.set_key(key, sizeof(key));

    Encoding section

    //Encode IV to Base64
    base64_encode(b64data, (char *)my_iv, N_BLOCK);    
    Serial.println("      IV -> Base64: " + String(b64data));
    Serial.println("       Orignal Msg: " + String(msg));

    //Encode message into Base64
    int b64len = base64_encode(b64data, (char *)msg, String(msg).length());
    Serial.println(" Message -> Base64: " + String(b64data));

    // Encrypt into AES256   
    aes.do_aes_encrypt((byte *)b64data, b64len , cipher, key, 256, my_iv);
    Serial.println("Encrypted: " + 

Open in new window

In reality, the "open file table" is not really a table, but let's say we will see it as a table. Which columns does this table have?

For example, see: https://cseweb.ucsd.edu/classes/sp16/cse120-a/applications/ln/lecture15.html

The open file table contains several pieces of information about each file:

the current offset (the next position to be accessed in the file)
a reference count (we'll explain below in the section about fork())
the file mode (permissions),
the flags passed into the open() (read-only, write-only, create, &c),
a pointer to an in-RAM version of the inode (a slightly light-weight version of the inode for each open file is kept in RAM -- others are on disk), and a structure that contains pointers to all of the .
A pointer to the structure containing pointers to the functions that implement the behaviors like read(), write(), close(), lseek(), &c on the file system that contains this file. This is the same structure we looked at last week when we discussed the file system interface to I/O devices.

So according to this, I would say:

- offset
- reference count
- file mode (permission)
- the flags passed into the open() (read-only, write-only, create, &c),
- pointer to in-RAM inode
- pointer to "read(), write(), close(), lseek(), &c".

But the file descriptor also points to the open file table, so we need another column that connects the "file descriptor table" with the "open file table". So I would add a column like:
I'm trying to investigate a problem with resource files generated by Google Omaha. These resource files contain a place-holder token (%1!s!), which is substituted with branding details during the build process. There are numerous language resource files that contains string tables and this

Here is an example string: "%1!s! some arbitrary text"

Where %1!s! is a place-holder for some substitution text?

My question: is this place-holder substitution mechanism a standard part of the Windows resource file mechanism? If so, can someone please either explain how it works? Where does it get the text used to substitute the place holder? I'm assuming the place-holder works similar to place-holders in printf? If so, how does it know which text token to replace this with? If this is not a standard resource file mechanism, does anyone have a clue as to how Omaha does this during the build process?

Many thanks.

Note: I'm not looking for suggestions to use a different approach. This is how Omaha does it and I just need to understand how this works. Thank you.
I am writing a Linux PAM module.
from pam_sm_authenticate I am calling a function to get the user password,

static int login_converse(pam_handle_t *pamh, int msg_style, char *message, char **password)
	CONST struct pam_conv *conv;
	struct pam_message resp_msg;
	CONST struct pam_message *msg[1];
	struct pam_response *resp = NULL;
	int retval;

	resp_msg.msg_style = msg_style;
	resp_msg.msg = message;
	msg[0] = &resp_msg;

	/* grab the password */
	retval = pam_get_item(pamh, PAM_CONV, (CONST void **) &conv);
	retval = conv->conv(1, msg, &resp,conv->appdata_ptr);
	if (password) {
		*password = resp->resp;
	return PAM_SUCCESS;

Open in new window

The string length of resp->resp I get is equal to the password length entered in the UI, but the value of resp->resp is always the same,
0x080a0d7f 494e434f etc...

What am I doing wrong, and how do I pull the clear text password out?
Redirecting output ([n]>[|]word), when does "n" greater than 2 make sense?

This question is about redirecting output in bash, see: https://www.gnu.org/software/bash/manual/html_node/Redirections.html#Redirecting-Output

The general format for redirecting output is:


I already understand the basics (you're just redirecting a file descriptor to a file for writing). But, can someone give me an example when it does make sense to use for example: 3>. In other words, if n is greater than stdin, stdout, stderr (>2), for what would you need it?

I can do:

echo 'test' 3> test-file.txt

Open in new window

This will not write anything to "test-file.txt". This is logical, because now there is just a file descriptor with number 3 pointing to test-file.txt for writing, but there is no input to fd=3 so there is also nothing to write.

The only way to give it some input is to connect file descriptor 3 for reading with a file (or connect it to the output of a pipe). But if you would do that, then fd 3 doesn't point to test-file.txt anymore. So then in the end, fd 3 was connected to test-file.txt without any reason.

So in what kind of situation it's useful to use >n with n greater than 2?
Binary bomb phase 3
I am having trouble understanding this part of my bomb lab. I am not sure where to go from here. I know that I need to figure out what two decimals values will make the program not explode. I have attached the assembly code for reference.
   0x0000000000400ffd <+0>:     sub    $0x18,%rsp
   0x0000000000401001 <+4>:     mov    %fs:0x28,%rax
   0x000000000040100a <+13>:    mov    %rax,0x8(%rsp)
   0x000000000040100f <+18>:    xor    %eax,%eax
   0x0000000000401011 <+20>:    lea    0x4(%rsp),%rcx
   0x0000000000401016 <+25>:    mov    %rsp,%rdx
   0x0000000000401019 <+28>:    mov    $0x402b5b,%esi
   0x000000000040101e <+33>:    callq 0x400c90 <__isoc99_sscanf@plt>
   0x0000000000401023 <+38>:    cmp    $0x1,%eax
   0x0000000000401026 <+41>:    jg     0x40102d <phase_3+48>
   0x0000000000401028 <+43>:    callq 0x4017e4 <explode_bomb>
   0x000000000040102d <+48>:    cmpl   $0x7,(%rsp)
   0x0000000000401031 <+52>:    ja     0x4010ca <phase_3+205>
   0x0000000000401037 <+58>:    mov    (%rsp),%eax
   0x000000000040103a <+61>:    jmpq   *0x402840(,%rax,8)
   0x0000000000401041 <+68>:    cmpl   $0x68,0x4(%rsp)
   0x0000000000401046 <+73>:    je     0x4010cf <phase_3+210>
   0x000000000040104c <+79>:    callq 0x4017e4 <explode_bomb>
   0x0000000000401051 <+84>:    jmp    0x4010cf <phase_3+210>
   0x0000000000401053 <+86>:    cmpl   $0x126,0x4(%rsp)
   0x000000000040105b <+94>:    je     0x4010cf <phase_3+210>
   0x000000000040105d <+96>:    callq 0x4017e4 

Open in new window

By default, the first three rows of a "file descriptor table" consists of:

FD 0 (standard input,  associated with keyboard)
FD 1 (standard output, associated with screen)
FD 2 (standard error,  associated with screen)

Open in new window

These file descriptors point to one or more rows in the "open file table". Imagine we only have these three file descriptors. Then how does the "open file table" look like?

Usually all three file descriptors point to the same file, but that doesn't mean they point to the same entry in the "open file table". So how the open file table looks like?

_ | offset | reference count | permissions | flags | pointers
_ |    ?   |        ?        |      ?      |   ?
possible more rows

Open in new window

The lsof command shows for example:

lsof        721    root    0u      CHR              136,1       0t0          4 /dev/pts/1
lsof        721    root    1u      CHR              136,1       0t0          4 /dev/pts/1
lsof        721    root    2u      CHR              136,1       0t0          4 /dev/pts/1

Open in new window

The file "/dev/pts/1" is CHR (character special file). They all point to the same file.
I'm also wondering why it's for example "0u" and not "0r"? The file descriptor 0 stands for input, so it only has to read something.

r for read access;
w for write access;
u for read and write access;

Open in new window

I would expect something like: 0r, 1w, 2w instead of 0u, 1u, 2u? And what are the offsets et cetera?
Hi Experts,

I need your help as I'm new to programming.  Could you please help me out with a solution for the below program?

The program simulates different errors that the protocol checks for.

           Modify the program so that it implements "time out".


          Sender: sends a frame and calls a SIGALRM function and sets the timer

           for say 2 seconds. If the sender gets a response within two seconds

           from the receiver (either "ACK" or "NAK"), turn off the alarm and

           transmit the next frame. If no response is received, time out function

           kicks in and retransmits the frame.

           Receiver: When it sees an error in transmission, do not send back

           anything to the sender and this causes the time out and retransmit.

How the Cloud Can Help You as an MSSP
How the Cloud Can Help You as an MSSP

Today, every Managed Security Service Provider (MSSP) needs a platform to deliver effective and efficient security-as-a-service to their customers. Scale, elasticity and profitability are a few of the many features that a Cloud platform offers. Register today to learn more!

Link to the problem:

The code works fine on my own system, but while submitting shows wrong answer?

   #include <stdio.h>
    void main()
    	int t, n, count;
    	scanf("%d", &t);
    	printf("\n%d", count);

Open in new window

I had this question after viewing Using AT commands with C.

I'm doing a project and want to connect my gsm "click" to my phone USING C PROGRAMMING, have it wired up ok just the program is letting me down..... [ I want the gsm to send a message to my phone ]
The GSM is connected to the UART serial port of my 8051f020 microcontroller, any help much appreciated my program is as follows:

 void send_it (void) interrupt 4 using 1   // This is the ISR 
		TI0 = 1; // TI must be cleared by software when writing directly  
	                       // to SBuf  as shown in the previous program – However,   
                   // the  Printf function requires TI to equal “1” on entering
		          // the function.
		printf ("Hello \n\n");  
   		printf ("This text was sent to the Uart using Printf \n\n"); 
    printf("AT+CMGF=1<CR>%c\n\n"); // configured the GSM module to SMS mode                                     

    ("AT+CMGS=\"08******\"HELLO"); // send mobile number to the GSM           

Open in new window

I am in need of an Excel macro that will perform the following:

Compare two columns of stock symbols that are numerically listed and the results of the comparison displayed in a third column.  I’m looking for stocks in column B that have improved in their numerical order (one being the best) from their listing in column A.  The results would be displayed in new column C, and the entries would be listed in order of those making the best improvement at the top.

•      Columns A and B contain 200 entries (rows) each.  No blank cells in either column A or B.
•      Column B may have symbols that are not contained in column A.  
•      Symbols in column B not listed in column A would receive the highest ratings in column C.
•      If there are two or more symbols in column B that are not in column A, the symbols in column B would be ranked accordingly in column C.

Example of conditions for column C listing using attached example file: Two columns of Symbols.xlsx.
•      Symbol ARDM is listed in column B but not column A, so it goes to the top of the list in column C and is listed alphabetically (preferred, but not necessary).
•      Symbol FCRE also listed in column B but not column A, so it goes to the top of the list in column C and is listed alphabetically (preferred, but not necessary).
•      ATNM was 151 in column A, and is 8 in column B, a gain of 143, so it would go above CADC, which was 91 in column A and is 10 in column B for a gain of 81.
•      CADC would go above NEPT …
Hello sir,
I am creating windows application using C# 2010 - Here i am using 3 forms
in my first form place a one data grid view and enter 6 rows but i am enter below format (it's stored at 2 empty rows)
EX :
Sl.No      Name       Age
1      A      10
2      B      11
5      C      12
6      D      13

Like this format - it's successfully stored at sql db.
IN my second form i am using approximately 10text boxes and enter 10 text boxes vales stored at sql db.
placed 2 drop down list and below one data grid view, here i am select  1st drop down(it's binding a first form db) records are display my 3rd form data grid view same as to form1 like below example,
but here i want
I am select a 2nd drop down binding a records 2nd form db. in my empty space cells how to display seconds form text box values as an row 3rd,& 4th rows.
Sl.No      Name       Age
1      A      10
2      B      11
5      C      12
6      D      13

any one give me suggestions.
Actually I have given a task to create an ini prase and Reding writing updating all these thing in c can you please help me something I have already attach an attachment  pls reply fast
The code snippet below is part of the restaurant menu program you previously used in the lab. Add a choice for a drink. Add the necessary code to allow the program to calculate the total price of order for the user. Assume the following price list:

Hamburger $5
Hotdog $4
Fries $3
Drink $2

The program should allow the user to keep entering order until choosing to exit. At the end the program prints an order summary similar to this:

You ordered 2 hamburger(s), 1 hotdog(s), 3 fries, 0 drink(s).

Price: $23
HST:  $2.99
Total: $25.99

Code snippet
do {

printf("What do you want to eat today?\n");
printf("1. Hamburger\n");
printf("2. Hotdog\n");
printf("3. Fries\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);

switch(choice) {
case 1:
printf("You ordered a hamburger\n");
case 2:
printf("You ordered a hotdog\n");
case 3:
printf("You ordered fries\n");
case 4:
printf("Order finished, thank you!\n");
printf("Wrong choice! try again: ");

} while (choice != 4)

Open in new window

needhelp in these ASAP
I am stucked in a project, where I have to convert some audio:
The Audio is PCM 16bit big endian 16Khz stereo & Ulaw 8bit 8000hz. Have to be able to go both ways.
Do you have any recommended Libs or even better software examples that will help me doing it :)

I get the audio in the PCM format as Callback data.
static int stream_GSMdata_2_ulaw(int16 id, char* data, uint32 size)
And after the conversion to Ulaw I need to send the RTP packets in 60 ms chunks (480bytes) via UDP:

Any help is appreciated :)
Need several WIX form drop-down boxes to have the data filtered on the previous drop-down results.  I found an example of utilizing a states.jw (??) import tool for states of the United States that is evidently 'built in' to WIX, however, my data is in another WIX database / dataset collection.    So, to be clear, the available drop down choices for drop box B is dependent (filtered) based on the results of drop-down A; the available drop down choices for drop box C is dependent (filtered) based on the results of drop-down B.  there are only these three dependent drop-downs at the moment.

Any step-by-step instructions would be absolutely fantastic!!  <<thanks in advance>>
I am working on creating an android app that scans the deleted data which is not overwritten by android device and recovers it, just like data recovery tool. How to create a recovery tool inside an android app is there a tutorial or any thing?
Build an E-Commerce Site with Angular 5
LVL 12
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

First of all I am doing a program kinda simple long program, here is the full details:

The P-v-T relation for real gases can take many forms. The simplest relations are the ideal gas equation and the Van der Waals equation. These relations are to be applied to superheated steam. The file “pvt.txt” contains the P-v-T data of superheated steam (10 – 800 kPa) for the temperature range of 200 oC through 1200 oC, obtained from the steam tables.

Write a C program to read the steam table data “pvt.txt”. In the C program, estimate the density of steam for the pressure range 10 through 800 kPa, and temperature range 200 oC through 1200 oC,

(1) Using the ideal-gas relation: m3/kg where R = 0.4615 kJ/kgK, T is temperature [K] and P is pressure [kPa].

(2) Using the Van der Waals equation:

where R = 0.4615 kJ/kgK, T is temperature [K] and P is pressure [kPa]. The constants are obtained from and where Pcr = 22060 kPa and Tcr = 647.1 K.

In each case, calculate the resulting percentage error of the estimated density as follows: Error = x 100% Submit a report which must include: 1. Introduction, algorithm or flowchart, the C program, and the density from steam table. 2. The estimated density table when using the ideal gas equation. 3. The percentage error table when using the ideal gas equation. 4. The estimated density table when using the Van der Waals equation. 5. The percentage error table when using the Van der Waals equation. 6. Discussion and conclusion. Note: Density…
void mainImage( out vec4 fragColor, in vec2 fragCoord ) 
    vec2 px = vec2(1.0) / iResolution.xy;
    vec2 pos = fragCoord.xy / iResolution.xy;
    vec4 color =  texture(iChannel0, pos);
    vec4 origColor = color;
    float numSamples = 1.0;

    	for (float x = -8.0; x <= 8.0; x += 1.0)
        	for (float y = -8.0; y <= 8.0; y += 1.0)
	        	vec4 addColor = texture(iChannel0, pos + (vec2(x, y) * px));
                if (max(addColor.r, max(addColor.g, addColor.b)) > 0.3)
                    float dist = length(vec2(x,y))+1.0;
                   // if (dist <= 5.0)
                        vec4 glowColor = max((addColor * 128.0) / pow(dist, 2.0), vec4(0.0));
                        if (max(glowColor.r, max(glowColor.g, glowColor.b)) > 0.0)
                			color += glowColor;
            				numSamples += 1.0;
    fragColor = mix(origColor, color / numSamples, 0.05);
    fragColor.a = 1.0;

Open in new window

Could you help me in converting this shader to #version 120 pleasee?
Dual pipe producer/consumer blocked by read.

The issue is in the producer:
        read(consumer_to_producer[0], &cnt, sizeof(cnt));
        read(consumer_to_producer[0], shared_arr, sizeof(shared_arr));

Open in new window

prevents the producer from working because the consumer has yet to write anything, how can I avoid this?

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#define SIZE 10

int shared_arr[SIZE];
int cnt = 0, in = 0, out = 0;
int consumer_to_producer[2], producer_to_consumer[2];

void consumer();
void producer();

int main() {
    pipe(consumer_to_producer); // consumer to producer
    pipe(producer_to_consumer); // producer to consumer

    if (fork() == 0) {
        /* child process */
    } else {
        /* parent process */


void consumer() {
    /* consumer process */
    close(producer_to_consumer[1]); // Close write end, we don't need it
    close(consumer_to_producer[0]); // This fcn doesn't need read end
    while (1) { 
        /* if buffer is full, consume it */
        // read in cnt from producer so we can check if it's full
        read(producer_to_consumer[0], &cnt, sizeof(cnt));

        if (cnt == SIZE) { /* If full, consume */
            read(producer_to_consumer[0], shared_arr, sizeof(shared_arr));
            printf("I am consuming\t%d\t%d\n", shared_arr[in], out);
            out = (out + 1) % SIZE;


Open in new window

I've got a style/control template for a ListView which is a variant on the default (attached).

However, I can't for the life of me figure out how to change the colours of the selected row in the ListView and the MouseOver item. At the moment the selected item and the hovered item's background is too bright.

I've tried adding a Style for a GridView but I get a message saying this isn't supported.

Am I missing something in the ListView control template? Where are these "default" colours coming from?
Write a C program to calculate the total size of the files in a directory and the sub-directories of the directory. 
Can someone please help to create regular pattern in c using regex.h to match sub string without matching terminating . character.

For example, from below string pattern should match “hello world.” and “hello world” (there is no . char at the end of second match)

|hello world.|hello world.

Thanks for your input!






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.