How to read year info from MBR - c++

I want to fetch the year information from the MBR. Here is my approach for this problem.
For any program, whenever we use 'version' flag we get the year information also. I gues it is the release year of that tool.
For example,
ls --version
ls (GNU coreutils) 8.25
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Richard M. Stallman and David MacKenzie.
Q1. Does the MBR contain the year's info?
Q2. If yes, How I can fetch it?
I can fetch the version info like this
read the first 512 bytes, seek the offset(0x3E) and read the next 2 chars.
Can anyone help me with this?

Related

Publishing the QT Project

My question is interesting. I'm learning QT Framework with C++ but I wonder a topic. I'm writing a project and want to publish it under the GPL license. In this case, do I have to pay a fee for my QT?
Please answer me. Thanks..
I'm writing a project and want to publish it under the GPL license. In this case, do I have to pay a fee for my QT?
No.
Qt is triply-licensed (details) under GPLv2/GPLv3, LGPLv3 (free) and a commercial license (paid); as long as you use the GPL version, you are in the clear even if you distribute your application as a "derived work".
That being said, you can always use the LGPLv3 version of Qt for free in an application with pretty much any other license (including commercial ones) as long as you link dynamically against it or provide the means to the user to re-link your application with his own version of Qt and your application's license doesn't place requirements incompatible with the LGPLv3 (which apparently is the case for GPLv2).

Find everything but version number

i have this text
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
58.0.3029 Copyright 2011 Google Inc.
I want is to find everything but
58.0.3029
I use this to find the pattern
\d+(\.\d+\.\d+)
So I have to find all but, the closest I could make was this
[\D+]+([\.\D+][\.\D+])
but it excludes other numbers 5.8 and 2011 too which I don't want to happen
Can you help me to find the right regex for that?
I use http://www.regexpal.com/ to test
I'm using a tool that's been developed with C#
Use anchors (in multiline mode):
^\d[\d.]+
# match the start of the line
# require one digit
# followed by digit(s) and dot(s)
And replace the found match with ''. See a demo on regex101.com.
To get everything but the version number:
([\s\S]*)\b(\d+\.\d+\.\d+)\b([\s\S]*)
Replace with: $1$3
Regex101 Demo
Output:
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
Copyright 2011 Google Inc.
If you want to capture everything but the version number, you can use the following:
([\s\S]*)\b\d+(?:\.\d+){2,}\s*([\s\S]*)
Regex101 Example

Use LLVM debugger inside Emacs on OSX Yosemite

I want to know if is possible to use the LLVM debugger with the Emacs, something like the M-x gdb interface standard.
Thanks in advance.
Adding LLVM debugger support to Emacs is surprisingly (or not, depending on your level of cynicism) contentious.
In February, 2015, Richard Stallman wrote:
The LLVM source repository includes a patch adding basic lldb support to gud.el.
It looks like there is a systematic effort to attack GNU packages.
The GNU Project needs to respond strategically, which means not by
having each GNU package cooperate with each attack. For now, please
do NOT install this change.
Stefan Monnier, one of the current maintainers, is much less hostile to the change:
Thanks, Andrew. I'd be happy to incorporate such a patch.
I took a quick look at the code, and seen from afar, there's no problem
with it, so all that is really needed is to clear the copyright status
of this code.
As of March, 2015, I don't believe that the LLVM debugger patch has been accepted.

debugging 64 bit C++ application on 32 bit gdb tool

we are using Sun Solaris for our application development and compiling 64 bit application by using -m64.
But the 32 bit GDB tool has been installed in my machine and we are unable to debug our 64 bit application.
The output as
$ gdb cxlog
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.10"...
(gdb) break main
Breakpoint 1 at 0x100001464: file cxlogger.c, line 147.
(gdb) run
Starting program: /usr33/SIR07140/GTB_HOME/GoTx_HOME/samples/cxlog
procfs:4337 -- process not stopped.
procfs: ...giving up...
(gdb) n
procfs: couldn't find pid 12372 (kernel thread 1) in procinfo list.
(gdb).
normal debugging commends like next & step are not working.
If I compile my application by using -m32 GDB is working file.
Thanks in Advance.
Sundar Rajendran.
You basically have three choices - in order of my preference:
Install 64-bit GDB on the machine.
Rebuild your app in 32-bit mode and debug that way.
Build your own version of gdb, for 64-bit targets, from sources.
The only way you'll debug a 64-bit binary is to have a gdb that is built for 64-bit [or some other debugger, but whichever it is, it needs to be built for 64-bit targets]

Why is "-std=c++0x" still needed for g++ 4.6.2? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I downloaded and built gcc 4.6.2. I find that for C++11 features, the command line option -std=c++0x is still needed. Why is that? Isn't is supposed to support it by default?
$ g++ --version
g++ (GCC) 4.6.2
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Because
C++11 is only 4 Months old and support for it is far from being complete or tested
changing the default without a big announcement and preparation phase for people is not nice
It is not clear if the default will ever change (see -std=C99).
Reading GCC website:
Status of Experimental C++0x Support in GCC 4.6
Thus you can't make default something experimental.
Moreover, It was before C++11 standard release, and the actual name was not defined, which explains why C++0x and not C++11.
If you're interested by GCC 4.7, it's still experimental:
Status of Experimental C++11 Support in GCC 4.7
It is still needed, and will probably stay this way for the foreseeable future, because C++11 has incompatibilities with C++03. Changing G++ to compile C++11 by default will break a lot of existing code.
I think the fact that it's called 0x gives you a hint. It's not even complete (see http://gcc.gnu.org/projects/cxx0x.html)