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 have a problem running any c programming using Widnows 10 command prompt, gcc ver is 3.4.2
please help
gcc: Internal error: Aborted (program collect2)  
Please submit a full bug report.
See <URL:http://www.mingw.org/bugs.shtml> for instructions.
From military to cyber security
From military to cyber security

If you've served in the military or worked in law enforcement, starting a career in cyber security may be a great move for you. Discover what cyber security professionals do, and how former military or law enforcement professionals can get started on this career path.

Dear all,

Using Turbo Pascal or C or Turbo C (well primitive), how I read several columns with numbers from a text file and give the sum of each one?

Thank you in advance (if I found anyone that have programmed in Pascal.
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!!!
ANSI c on OSX 10.13.6 <br>
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix

I'm learning `c`

This is a function that manually (character-by-character) adds two character strings representing large numbers (that exceed the unsigned long long or double size).

It functions fine with any two strings 14 or less characters long, but segmentation fault 11 with any strings greater than 14 chars.

Changing the string's memory allocation method seems to have no effect (I.e. from
char[15] addend1; // not a ptr

Open in new window

char *addend1 = (char *) malloc(sizeof(char) * (16) ); // pointer

Open in new window

One things that's curious, is that it seems to segfault on the ...
for (int j = maxlength - 1 ; j >= 0; j--)

Open in new window

... prior to accessing either of `addend1` or `addend2`, but I'm not able to find an error there or change it to prevent the segfault.  

Am I misreading where the error arises, or could it be related to the for loop?


	#include <stdio.h>
	#include <stdlib.h>
	#include "../../c-library/include/addViaStrings.h"
	int main(void) {
		//	s[0] = 72; s[1] = 101; s[2] = 108; s[3] = 108; s[4] = 111; s[5] = 32; s[6] = 87; s[7] = 111; s[8] = 114; s[9] = 108; s[10] = 100; s[11] = 0;
		// WORKS
		// char s1[] = "14073748835532";
		// char s2[] = "14073748835532";
		// FAILS
		char s1[] = "140737488355328";
		char s2[] = "140737488355328";
		char *sum = addNumericStrings(&s1, &s2);
		printf("main.sum = %s\n", sum);

Open in new window


Open in new window

Hi I have a 2D vector in a library which gets populated with different types of data this part is working fine now I need to pass the 2D vector back to my main app from a function call but this function call is failing

Here is the structure that makes up the vector in the library and how I am trying to call the data in the vector from a function:
//Library code
typedef struct _DEVICEDETAILS
	std::string IPaddr;
	int HTTPPort;
	int HTTPSPort;
	int RTPSPort;
	std::string Model;
	std::string Name;
	std::string token;
	std::vector<std::string> RSTPURL;
	std::vector<char*> data;
	std::vector<size_t> datalen;
	std::string _mediaXaddr;
	int Encoding;
	int Width;
	int Height;
	int Quality;
	int FrameRateLimit;
	int EncodingInterval;
	int Bitrate;


	std::string MacAddr;
	std::vector<DEVICEDETAILS> _videotype;

std::vector<std::vector<ONVIFDEVICE>> v_Device;

void GetOvifInfo(std::vector<std::vector<ONVIFDEVICE>> &returnInfo)
  other code .......
   int m_size =v_Device.size();
   v_Device[nFindDev].push_back(m_Mac); // info gets populated into each element here
  //Need to do a deep copy from vector v_Device to  vector returnInfo


// Main App code
typedef struct _mDEVICEDETAILS
	std::string IPaddr;
	int HTTPPort;
	int HTTPSPort;
	int RTPSPort;
	std::string Model;
	std::string Name;
	std::string token;
	std::vector<std::string> RSTPURL;

Open in new window

I have a Dell 5810 workstation with Win 10. Drive c: = 1tb ssd. Drive d: = 1tb ssd. I have slots for two mechanical drives. One has failed and instead of replacing it with one 6 tb drive I was wondering if I purchased two 4tb WD black drives and used them in a raid 1 configuration that it would be my best solution. I do not need speed on the two mechanical drives. They would essentially be shown as a single 4tb drive, each with the same exact data for safety. I spoke to Dell and they said it is definitely possible. I do not want to affect my c or d drives at all. So, my question is: What software is super simple to use in order to implement raid 1 on the two new identical drives?
I have following version of eclipse IDE installed in my computer:
Eclipse IDE for C/C++ Developers
Version: 2018-09 (4.9.0)

I created a workspace.  There are number of Templates for New C / C++ Project.
I need to import very large 'C' source code files into my project.  I won't be compiling code in eclipse.  I'll just be navigating source code.
Which Project template should I select?  Is there a way to create project without selecting a project template?
Actually the file descriptor table is not a real table. It's just an array of pointers to the "open file table" (struct file). But let's say we will see it as a table. What are the columns? For example:

FD   | Pointer to "open file table"
...  | ...

In short, that's the question. I see a lot of different figures on the internet, but they are all different. For example, see:

There they have a column "fd flags" (read/write), but I would think that this column is part of the "open file table" and not part of the "file descriptor table". See for example: http://man7.org/linux/man-pages/man2/open.2.html

       A call to open() creates a new open file description, an entry in the
       system-wide table of open files.  The open file description records
       the file offset and the file status flags (see below).  A file
       descriptor is a reference to an open file description; this reference
       is unaffected if pathname is subsequently removed or modified to
       refer to a different file.  For further details on open file
       descriptions, see NOTES.

       The argument flags must include one of the following access modes:
       O_RDONLY, O_WRONLY, or O_RDWR.  These request opening the file read-
       only, write-only, or read/write, respectively.
See: https://www.kernel.org/doc/Documentation/filesystems/vfs.txt

Dentries live in RAM and are never saved to disc:

A directory is also a file (special file). The contents of a directory consists of:

.           inode-number-current-directory
..          inode-number-parent-directory
filename_1  inode-number-A   
filename_2  inode-number-B
et cetera...

Open in new window

Usually this data is stored in data block(s). I say "usually" because some systems may store this in the directory's inode (< 60 bytes). But usually the data is stored in data block(s). If you make an empty directory, then the contents are:

.           inode-number-current-directory
..          inode-number-parent-directory

Open in new window

Usually you will see something like this:

Blocks: 8

Open in new window

8*512=4096 bytes. So 4096 bytes in the form of data blocks are allocated on disk. A dentry is just a directory entry, so:

filename_1  inode-number-A

Open in new window

So dentries are stored on disk. Then how I have to see this sentence?

Dentries live in RAM and are never saved to disc:

If they would only live in RAM, then you will lose all your dentries if the computer restarts? And why they are not stored on disc/disk? A directory usually just shows 8 blocks, this means that it is stored on disk.

Do I make a mistake here or what's behind it?
dup2(int oldfd, int newfd);

Open in new window

This is an equivalent of:

close(int newfd);
dup(int oldfd);

Open in new window

By closing "newfd" first, it becomes the lowest-numbered unused file descriptor (normally). Because of that the oldfd is copied to newfd (dup system call). So far, everything is clear.

Now see: http://codewiki.wikidot.com/c:system-calls:dup2

dup2 is a system call similar to dup in that it duplicates one file descriptor, making them aliases, and then deleting the old file descriptor.

Actually I don't think the old file descriptor will be deleted?

See: http://man7.org/linux/man-pages/man2/dup.2.html

After a successful return, the old and new file descriptors may be used interchangeably.

If the old file descriptor will be deleted, then they would not say something like that. Is wikidot.com just wrong about this?
10 Tips to Protect Your Business from Ransomware
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

I'm trying to understand the structure of the open file table. During this search I'm reading things that look like (for me) they are in contrast with each other.

In a system there is a:

File descriptor table:
This table is located in user space and is associated with a certain process (per-process).

Open file table:
This table is located in kernel space and is associated with all processes (process-wide).

Entries in the file descriptor table point to the open file table. This all is clear. Now let's go to the structure of these tables. For example, see: https://elixir.bootlin.com/linux/v3.18/source/include/linux/fdtable.h#L24

struct fdtable {

Open in new window


 * Open file table structure
struct files_struct {

Open in new window

Also this is clear. But now see for example: http://www.andrew.cmu.edu/user/gkesden/ucsd/classes/sp17/cse291-a/applications/ln/lecture5.html

Per Process File Information

struct files_struct { /* kept within task_struct (PCB) */

Here they are talking about files_struct when it's about "per process file information". I don't understand this, because the open file table is process-wide. This is for example what they are saying:

The count variable tracks the number of files the process has open

But imagine ... two different processes point to the same entry in the open file table. I think …
My question is about a pipe/pipeline in Unix. And it's especially about the FD (File descriptor) numbers/integers associated with it.
This is what I would expect:

  0 stdin
  1 stdout -> pipe -> 0 stdin
  2 stderr            1 stdout
                      2 stderr

Open in new window

However, on the internet I'm reading different things.

For example, see: http://pubs.opengroup.org/onlinepubs/009696799/functions/pipe.html

Their integer values shall be the two lowest available at the time of the pipe() call.

Also see the images here: http://www.rozmichelle.com/pipes-forks-dups/#attachment_7362

Why new file descriptors are created? Why they don't use stdout (1) of the parent process? They could just redirect this existing
file descriptor (1/stdout) to the pipe. Do I miss something?
Please provide reference(s) that git doesn't require system administration.

Earlier today I asked question is there a version control system that doesn't require system administration.  
Expert answered Git.

I could google this information.  Please provide some links that confirm that git doesn't need system administration.
Hi I am trying make a deep copy of the structure below which will contain the decoded video frames and copy to a new element in a vector without each previous element being overwritten.
The structure below is being populated as the memory in debug mode is increasing as expected with each pass of the while loop.
struct YUV_Buffer
mfxFrameSurface1  *mSurface;
YUV_Buffer(mfxFrameSurface1 *pBuf = { 0 })
    : mSurface(new mfxFrameSurface1[sizeof(mfxFrameSurface1)])
    memcpy(mSurface, pBuf, sizeof(mfxFrameSurface1));

YUV_Buffer(const YUV_Buffer& YuvBuf) 
 : YUV_Buffer(YuvBuf.mSurface)  

YUV_Buffer& operator = (YUV_Buffer YuvBuf) {

    std::swap(mSurface, YuvBuf.mSurface);
    return *this;

~YUV_Buffer() {

Open in new window

I am calling the structure and copying the elements into the vector with each iteration of the while loop "mfxFrameSurface1 pVPPSurfacesOut[nSurfIdxOut]" contains all the information regarding the decoded video frame I need to copy pVPPSurfacesOut[nSurfIdxOut] to the vector mBuffer.push_back(root) using a deep copy so the data that the pointers in the structure are pointing to are also copied but what is actually happening is the last frame processed is overwriting all previous elements in the vector. Each time the loop passes like this: I have removed the code that is decoding each frame as its no relevant I just need to work out why the elements are getting overwritten in the vector
std::vector<YUV_Buffer> mBuffer;
YUV_Buffer root(pVPPSurfacesOut[nSurfIdxOut]);

Open in new window

each iteration of the while loop populates pVPPSurfacesOut[nSurfIdxOut] structures which contain pointers with video information like height width buffersize … and the video data its self in a NV12, YUV420 colour space, I need to access each frame from the vector mBuffer but when I try to access the vector mBuffer[0]… Im getting the last frame copyed to the vector.

Regards Nigel
I have code to allow me to right click by mouse to bring to me menue of copy and past and delete

And have other to do copy and past but by key board ctrl c and ctrl v

As attached photo

I need to bind right click mouse to bring the code if ctrl c and ctrl v
what is the best tool to do profiling for c++ multi threaded server daemon on Linux?

Complied program with -pg and the tried with gprof/gmon.out. Couldn't find call graph as per functions mentioned in my program. It has shown all low level api's call graph like string internals, memory allocations..etc.

Can someone suggest how to get call graph from gmon.out for multi threaded server daemon.

Any other tool(s)?
Sonicwall site-to-site VPN speed.  We have a main site - Site A, and 2 remote sites - B & C.  Site A has internet speed of 20M/300M.  The remote sites have 10M/100M.  From site A we can only "upload" data to the remote sites at 10M.  Shouldn't we be able to push data to the remote sites at closer to the 20M upload speed of the main site?  Sonicwall support says it's limited by the slowest speed, but that doesn't make sense to me.  Are they correct?
From a SQL 2008R2 database, using Exlcel 2010,
I need to update the D cell (Account No)-number  by using the values in the C cell (Client ID) -text.
The key to select off the SQL table, CLients, is CLIENT_ID (text) and I need to return the SQL column ACCOUNT_NO (int) and update the column 'Account No' on the excel spreadsheet.
I'm assuming I need to create an ODBC to the SQL Database, which I have.
Microsoft Excel
The attached file contains ID in Column A and ID in Column C.
The problem is that the ID list in column A does not correspond with the ID list in Column C.
I am seeking a script that will move contents of A & B to the row where the ID in Column A corresponds with the ID in Column C.
Note: There may be some rows where there is an ID in Column A and no corresponding ID in Column C (Row 1746). In this case, the cells from  C to U are moved down.

In the example, the  rows have been adjusted manually until row 1963.
High-tech healthcare
High-tech healthcare

From AI to wearables, telehealth to genomics to 3D printing — healthcare technology is seeing rapid advancement. Experts believe that this technological advancement will save money and save lives. Healthcare is changing dramatically, and emerging technology drives that change.

I have windows server 2012 and the print spooler is now in C drive, how to move the print spooler share from C to another location?
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
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
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.
In AD Sites & Services, we have four sites set up...

Site A =
Site B =
Site C =
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}
how to get the SwapTotal for solaris in C or C++?






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.

Top Experts In