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

Server 2016 Update Patch install recked my server. I eneded up with a completely fresh copy of server 2016 with only a naked Administrator when I woke up this morning. All setting are back to default etc. etc. NO WINDOWS.OLD FOLDER was even left for me.
However, even though shadow copies was somehow turned off I have a shadow copy drive that contains a pretty recent version of the C drive.
What can I do to overwrite the C drive data with this data? Vol Shadow copy is not an option because the only thing I could do was to turn it back on which created a copy of today.
0
Making Bulk Changes to Active Directory
LVL 8
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

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
0
i am looking for power shell script for below purpose.
1. Copy files from A folder to C, D
C - Destination.
D - backup copy.
and  log the details something like robocopy output and send email if any failures or errors found in script.
can help pls
0
While posting Multiple sensor data through arduino data is not saving in my sql

Arduino Code:


#include<SoftwareSerial.h>
#include <SPI.h>
#include <DHT.h>
SoftwareSerial client(2,3);
#define DHTPIN 7
#define DHTTYPE DHT22
DHT dht(DHTPIN,DHTTYPE);




//String reading="{\"yourdata\" : 12.983027,}";

//String reading="{  \"   \"yourdata\" : 12,  \"timestamp\" : 100,  }";

//#define ONE_WIRE_BUS D4
//OneWire oneWire(ONE_WIRE_BUS);

//DallasTemperature sensors(&oneWire);


float dstemperature;
float TempCelcius=0;
float Fahrenheit=0;
float Humidity=0;


int yourtemparduinodata;
String yourtempdatacolumn = "VALUE1=";

int yourhumidarduinodata;
String yourhumiddatacolumn = "&VALUE2=";

String VALUE1;
String VALUE2;
//String VALUE1;
long previousMillis = 0; 
long interval = 1000; 

unsigned long currentMillis=0;

String data;
String TempData;
String HumidData;
void setup()
{
  dht.begin();
  Serial.begin(9600);
  client.begin(9600);
  Serial.println(client);
  //SIM900.begin(9600);  /* Define baud rate for software serial communication */

  delay(500);

  if(client.available())
  {
    Serial.print("Connected");
  }
  else
  {
    Serial.print("NotConnected");
  }

  
}

void loop()
{


  connectGPRS();
  connectHTTP();
 
  delay(60000);

  
  
}



void connectGPRS()
{ 
  client.println("AT+SAPBR=3,1,\"Contype\",\"GPRS\"");
  delay(1000);
  ShowSerialData();

  client.println("AT+SAPBR=3,1,\"APN\",\"www.airtelgprs.com/\"");//APN
  delay(1000);
  ShowSerialData();

  

Open in new window

0
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");
break;
case 2:
printf("You ordered a hotdog\n");
break;
case 3:
printf("You ordered fries\n");
break;
case 4:
printf("Order finished, thank you!\n");
break;
default:
printf("Wrong choice! try again: ");
}

} while (choice != 4)

Open in new window


needhelp in these ASAP
0
Dear experts,

Can anyone please share with me either free or paid online/downloadable courses for C.

What I have in mind is  a detailed level of explaining the principles of the language/code/syntax.

Thank you
0
Hi
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:
 SendRTPData(myData);

Any help is appreciated :)
0
I am considering whether the starting position for the pattern vis-a-vis the searched text,  (i.e. the LAST CHARACTER of the pattern be aligned) ought to initially coincide with the first appearance of that LAST CHARACTER in the searched Text, *provided that appearance is equal to or more than the length of the Pattern*, since otherwise the index would have occurred too early in the sequence to be valid.

Consider this illustration from the B-M paper :

Search starting alignment
The B-M algo would 'mismatch' the final T from the 'pat' with the F from the 'string', and move the pattern past the F, to align the A with the I. Whereas the first contending T in the pattern and the string is at index 17 in the string, rather than the standing comparison being done at index 7.
0
I have a recursive file search for Linux written in C. I want to modify it to use multiple threads (4).

I was thinking I could use main to gather the list of all files/folders in the provided starting directory and then call threads on each of those. How would I go about implementing that? I've read up some on pthreads but I'm not sure I fully understand it.

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <sys/time.h>
#include <errno.h>

//takes a file/dir as argument, recurses,
// prints name if empty dir or not a dir (leaves)
void recur_file_search(char *file);

//share search term globally (rather than passing recursively)
const char *search_term;

int main(int argc, char **argv)
{
	if(argc != 3)
	{
		printf("Usage: my_file_search <search_term> <dir>\n");
		printf("Performs recursive file search for files/dirs matching <search_term> starting at <dir>\n");
		exit(1);
	}

	//don't need to bother checking if term/directory are swapped, since we can't
	// know for sure which is which anyway
	search_term = argv[1];

	//open the top-level directory
	DIR *dir = opendir(argv[2]);

	//make sure top-level dir is openable (i.e., exists and is a directory)
	if(dir == NULL)
	{
		perror("opendir failed");
		exit(1);
	}
	
	//start timer for recursive search
	struct timeval start, end;
	gettimeofday(&start, NULL);

	recur_file_search(argv[2]);

	gettimeofday(&end, NULL);
	printf("Time: %ld\n", (end.tv_sec * 1000000

Open in new window

0
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>>
0
Cloud Class® Course: Python 3 Fundamentals
LVL 12
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

In AD Sites & Services, we have four sites set up...

Site A = 192.168.1.0/24
Site B = 192.168.0.0/24
Site C = 192.168.4.0/24
Default-First-Site-Name, not assigned any subnets.

Sites A & B have two DCs a piece. All DCs are GCs. Site C has one DC which is a GC.

Sites A & B have one Exchange 2013 server a piece. Both servers have the Mailbox and Client Access roles. The Exchange servers were brought into AD before Sites & Services was set up. So their Site and AutoDiscoverSiteScope were originally set to Default-First-Site-Name.

Once we established our sites, we assumed the msExchServerSite value would update automatically based on site affinity. It has not. We have dealt with the issues that result from both servers being assigned to the Default-First-Site-Name for long enough and wish to get this corrected.

How do we get the site affinity to update, and once it does, will we still have to run the command, Set-ClientAccessServer <server name> –AutoDiscoverSiteScope <name of AD Site>, to correct the AutoDiscoverSiteScope?

Some Shell commands below for reference...

[PS] C:\>get-exchangeserver | ft name,site -autosize

Name Site
---- ----
MAIL1 domain.local/Configuration/Sites/Default-First-Site-Name
MAIL2 domain.local/Configuration/Sites/Default-First-Site-Name


[PS] C:\>get-clientaccessserver | ft name,autodiscoversitescope -autosize

Name AutoDiscoverSiteScope
---- ---------------------
MAIL1 {Default-First-Site-Name}
MAIL2 …
0
how to get the SwapTotal for solaris in C or C++?
0
Dear experts,

Can anyone point to any online site which can has c/c++/Python programs written/used for Financial Engineering.

The idea is show the content/calculations involved in Financial Engineering to my tutor who can then teach me leading to building my fundamentals.

My tutors teaches for Engineering college students and may not have the orientation of Financial Engineering programming features/calculations.

Kindly guide.

Thank you
0
I am trying to figure out how to re-allocate space on a new VM installation for a server.  I need a C drive of around 100gb and the rest a D drive.
I can't seem to determine where this is done.  I am going back to the VM installation and do not see an area to do that.  If I need to trash the installation and do it over I can.
0
Downloaded a Sample App.  I am using VS2015.  The app doesn't compile.  I am receiving what seems to be a REST error.

CS1503      Argument 2: cannot convert from 'System.Action<System.IO.Stream>' to 'byte[]'      Tradovate.Services      

The error is occurring at

                request.AddFile(param.Value.Name.ToString(), param.Value.Writer,
                                param.Value.FileName.ToString(), param.Value.ContentType.ToString());

In the below code.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
using System.IO;
using System.Web;
using System.Linq;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using RestSharp;

namespace Tradovate.Services.Client
{
    /// <summary>
    /// API client is mainly responsible for making the HTTP call to the API backend.
    /// </summary>
    public partial class ApiClient
    {
        private JsonSerializerSettings serializerSettings = new JsonSerializerSettings
        {
            ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor
        };

        /// <summary>
        /// Allows for extending request processing for <see cref="ApiClient"/> generated code.
        /// </summary>
        /// <param name="request">The RestSharp request object</param>
        partial void InterceptRequest(IRestRequest request);

        /// <summary>
        /// Allows for extending response processing for <see

Open in new window

0
I'm following the example on https://docs.microsoft.com/en-gb/visualstudio/test/walkthrough-creating-and-running-unit-tests-for-managed-code
to learn about unit testing.
When I add the reference to Bank.sln I'm getting a message:

A reference to D:\Documents\UnitTesting\Bank\Bank.sln could not be added.  Please make sure that the file is accessible, and that it is a valid assembly or COM component.
Could it be because Visual Studio 2017 is installed on my C drive and this project is on my D drive?  I'm using C#.net
0
Dear experts,

Can some experts please refer a url for downloading 'dec-c++'.
It could be either a paid or a free version.

I am learner of C/c++ program, so i am happy to go with minimum cost to start the process with.

Thank you
0
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?
0
Hello everyone

I have this program:

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
main(){
    FILE *f1;
    FILE *f2;

    f1 = fopen("pvt.txt","r");
    f2 = fopen("second.txt","w");

     int i,j;
     float v[9][6],vdr[9][6],edr[9][6],v0[9][6]; //V
     float p[9]={10,50,100,200,300,400,500,600,800}; //Pressure
     float T[6]={200,400,600,800,1000,1200}; //Temperature
     float a,b,Pcr=22060,Tcr=647.1,R=0.4615,diff;


     a=27*0.4615*0.4615*647.1*647.1/(64*22060.0);
     b=0.4615*647.1/(8*22060.0);


    //                  //

    /*Read input file for v from steam table*/
     for(i=0;i<=8;i=i+1)
       fscanf(f1,"%f %f %f %f %f %f",&v[i][0],&v[i][1],
            &v[i][2],&v[i][3],&v[i][4],&v[i][5]);


    /*Write v steam table to output file*/
    fprintf(f2, "The V Steam Values = \n");
     for(i=0;i<=8;i=i+1)
       fprintf(f2,"%f %f %f %f %f %f \n",v[i][0],v[i][1],
            v[i][2],v[i][3],v[i][4],v[i][5]);

            //          //
            for(i=0;i<=8;i=i+1)
                        for(j=0;j<=5;++j)

                            while(diff>0.001)
                            {
                            v[i][j]=v0[i][j];
                            v[i][j]=b+0.4615*(T[j]+273.15)/(p[j]+a)/(v0[i][j]*v0[i][j]);
                            diff=fabs(v[i][j]-v0[i][j])/v0[i][j];
       }
/*Write v using VDR to output file*/
        fprintf(f2, "The V using VDR Values = \n");
     for(i=0;i<=8;i=i+1)
       fprintf(f2,"%f %f %f %f %f %f

Open in new window

0
Has Powershell sent you back into the Stone Age?
LVL 8
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

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…
0
Suppose the length of array is dynamic and the elements follow the same pattern where by the next element is half the previous element. For example
1024, 512, 256, 128...

Open in new window


I would like to directly determine the index of an element. For example if I have
512

Open in new window

I would output index
1

Open in new window

without looping through the elements and comparing them with 512 then output 1. i.e not like this:

for (int i = 0;  i < length;  ++i) {
    if (array[i] == 512) { 
        printf("%d\n", i);
        break;
    }
}

Open in new window


I have been thinking of using modulus or bit manipulation like shifts but I can't get it to work. How can this be achieved?
0
Dear experts

I am a beginner in any programming language. I am currently learning C.

I have managed to write a code in bits and pieces to achieve the following

Model 1:

AAASAAA
AASSSAA
ASSSSSA
SSSSSSS
ASSSSSA
AASSSAA
AAASAAA


Model 2

AAAAAA
AASSAA
ASSSSA
AASSAA
AAAAAA


My code

#include<stdio.h>
#include<math.h>
main()
{
      int r,c;
      for(r=3;r>=1;r--)
      {
            for(c=1;c<=r;c++)
            {
                  printf(" A");
            }
            for(c=3-r;c>=1;c--)
            {
                  printf(" S");
            }
                        for(c=3-r;c>=1;c--)
            {
                  printf(" S");
            }
            for(c=1;c<=r;c++)
            {
                  printf(" A");
            }
            
      printf(" \n");      
      }
      
}


Can anyone please update my code.

Thank you
0
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?
0
Prevent color change when vim is invoked.

My computer is running Windows 10 Pro 64-bit.  I connect to remote Linux Machine using telnet utility.

My shell is bash.  My terminal emulator screen has black background and white foreground.  I invoke vim <filename>.  I exit vim and return to
my terminal.  Now the terminal has changed colors.  man vim doesn't have color option that will tell me how to disable color when vim is inovked.
0
I have a commercial .exe file which can communicate and analyze data with my instrument. However, upon running, it says it wants some functions for communicating with the instrument (functions of a driver). I have got .dll folder and library folder which contains these functions. Now how do I add these function capability into the .exe.

I need to run this in windows 2000. I have installed visual basic 6.0 also. But dont know what to do next. Any help is greatly appreciated. I need to go a long way in this project and this is the first step. please.....

The picture shows the Mil dll it is asking for
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.