825 Posted Topics

Member Avatar for diocode

[code]$ export INDEXFILE=/path/to/index/file/index.html $ find . -type d -exec cp -i ${INDEXFILE} '{}' \;[/code] That copies [icode]${INDEXFILE}[/icode] interactively to every directory found below the execution point. N.B. Not tested.

Member Avatar for cfajohnson
0
151
Member Avatar for profyou

Have a look at the stream [icode]operator>>[/icode] [url=http://www.cplusplus.com/reference/iostream/istream/operator%3E%3E/]here[/url] and [icode]operator![/icode] [url=http://www.cplusplus.com/reference/iostream/ios/operatornot/]here[/url]. The extraction operator returns a reference to the stream, not a boolean value. You can check the stream state through its provided interface.

Member Avatar for deceptikon
0
181
Member Avatar for karthickk02

That is a binary format. You will not be able to get original source code from that (other than ASM, of course). One tool you can use is [icode]readelf[/icode]. You can also use [icode]objdump[/icode] if you wish to get at the assembly of the program.

Member Avatar for L7Sqr
0
94
Member Avatar for chamika.deshan

That is just a macro that expands in your code snippet[code]class A { FRIEND_NEW protected: A(); };[/code] to [code]class A { template<class T> friend inline T* ::safe_new(const char*,int); protected: A(); };[/code]

Member Avatar for L7Sqr
0
163
Member Avatar for Dewey1040

I'd suggest you read the contents into a [icode]std::string[/icode] and just use the [icode]substr[/icode] method to do the work for you. For example:[code]int main () { const std::string input = "GATCGAT"; std::size_t offset = 0, len = input.size (), window_step = 1; std::cout << "INPUT: " << input << std::endl; …

Member Avatar for L7Sqr
0
147
Member Avatar for ruval002

In a makefile, the [icode]=[/icode] is destructive assignment. You may be looking for somethign more along the lines of: [code]OBJ = main.o ll.o[/code] or[code]OBJ = main.o OBJ += ll.o[/code] This is also apparent in the output of make where your compile line has only the [icode]ll.*[/icode] file names listed.

Member Avatar for caut_baia
0
170
Member Avatar for arunsolo1984

You can use the c pre-processor to do this. The command [code]cpp -dM file.c[/code] will list out all macros define in [icode]file.c[/icode] (including built-in and included file macros). This will not expand these macros, look at the man pages for [icode]cpp[/icode] for details on how to do that.

Member Avatar for L7Sqr
0
50
Member Avatar for juce

You are using the wrong data structure. You should use a vector, array, set or some other container than a string. With your example strings (which elements are characters) your union would be [icode]",12345"[/icode]. If you must use a string you are going to have to break it up into …

Member Avatar for mazzica1
0
1K
Member Avatar for Labdabeta

[url=http://linux.die.net/man/2/exit]exit(2)[/url] and [url=http://linux.die.net/man/3/exit]exit(3)[/url] each have a good description.

Member Avatar for Labdabeta
0
224
Member Avatar for Ahmed2

You want to check the stream - which is [icode]outData[/icode] in your case. That should look like:[code]if (outData.good ()) { // ... } outData.close ();[/code]The [icode]file[/icode] variable is not declared anywhere and that is what the coimpiler is complaining about.

Member Avatar for Ahmed2
0
423
Member Avatar for geoffy0404

Have you tried playing around with the commands? [code]$ tr ':' ' ' < /etc/passwd | head -n 5 root x 0 0 root /root /bin/tcsh bin x 1 1 bin /bin /sbin/nologin daemon x 2 2 daemon /sbin /sbin/nologin adm x 3 4 adm /var/adm /sbin/nologin lp x 4 …

Member Avatar for L7Sqr
0
153
Member Avatar for swissknife007

How are you handling the input/output? Given that you can read from stdin and write to stdout why not just filter the input?[code] int main () { int c = 0; while (EOF != (c = fgetc (stdin))) { switch (c) { case '4': case '7': break; default: fputc (c, …

Member Avatar for mhd_arif123
0
204
Member Avatar for Icostyle

If you can give a valid reason why we should earn your degree for you then perhaps you will get a valid answer. Until then, dont hold your breath.

Member Avatar for zachmandude32
0
213
Member Avatar for tanvirraj91

I'm not sure what either of "docs" or "environment is black" means specifically but you might try [url=http://clang.llvm.org/]clang[/url] which is a frontend for [url=http://llvm.org/]llvm[/url]. Very powerful toolset. Works on Windows and Linux.

Member Avatar for DeanMSands3
0
168
Member Avatar for ohblahitsme

The idea of saving data to a file to later load into program-related data fields is known as [url=http://en.wikipedia.org/wiki/Marshalling_(computer_science)]marshalling[/url]

Member Avatar for WaltP
0
101
Member Avatar for infantheartlyje

Editors load file contents into memory. How that memory is stored is different for each editor but, for example purposes, you might consider it as a doubly linked list. The cursor is simply sitting at whatever node you are currently at in the list. Adding text on screen is equivalent …

Member Avatar for deceptikon
0
237
Member Avatar for ruval002

Just convert [code]struct Process { int id; Process *next; };[/code] to [code]struct Process { int id; state_t state; Process *next; };[/code]Where [icode]state_t[/icode] is defined as[code]enum state_t { READY, RUNNING , ... };[/code] Of course, you will need to fill that enumeration with as many states as you would like to …

Member Avatar for L7Sqr
0
468
Member Avatar for SergioQ

If the data you were looking for has been overwritten then you are pretty much out of luck unless you have forensics tools. If not, you may try to mount the drive on an external machine and iterate through the filesystem structure. If the file was just marked for deletion …

Member Avatar for YourGamerMom
0
101
Member Avatar for jatinkhandelwal

Then you need to create a mapping from data type to size and store it in a file. Once you've done that just search that file for the data type you are interested in. Although, as [b]WaltP[/b] has already mentioned, the size of a type is available at compile time …

Member Avatar for Ancient Dragon
0
124
Member Avatar for sagarnarasgonde
Member Avatar for Moschops
0
168
Member Avatar for jman2011

Here is a hint: it involves [icode]#include <cctype>[/icode] (or [icode]#include <locale>[/icode]) and [icode]std::isupper[/icode].

Member Avatar for WaltP
0
196
Member Avatar for ajai.solinfi

It might be better for you to sort each of [icode]file1[/icode] and [icode]file2[/icode] first. That way you can simply iterate through the file you want to filter removing any matches in the other file. Since the two will be sorted you can filter in a single pass instead of the …

Member Avatar for ajai.solinfi
0
263
Member Avatar for a-lago

My guess is that you do not know what is stored in [icode]unsorted[/icode]. From the error message it looks like it is an array of arrays while you are expecting it to be a simple array of values. It is difficult to tell for sure without understanding the calling context.

Member Avatar for a-lago
0
750
Member Avatar for sota

Iterate through the rows checking which columns are zeros. Build a new array of rows that are not all zeros while you are doing this.

Member Avatar for sota
0
467
Member Avatar for Gaiety

You are telling the write call (which is not looking for null terminated strings) to write up to 1024 bytes but only providing 11 bytes to be written. [icode]write[/icode] will happily try to continue to read from wherever [icode]"hello first"[/icode] is stored in memory for 1024 bytes. Since constant strings …

Member Avatar for Gaiety
0
124
Member Avatar for jatinkhandelwal

That comment doesn't really make much sense. What do you mean by [i]data structure of a file[/i]? And how, exactly, is that in 'another file?'

Member Avatar for L7Sqr
0
106
Member Avatar for b56r1

There are certain situations (usually concerning automation and repeatability) where you would like a machine to configure a particular way on boot. A common case is in a system like [url=http://www.emulab.net/]Emulab[/url] where there are potentially hundreds of machines that need to be configured and automated in a very particular way. …

Member Avatar for L7Sqr
0
148
Member Avatar for noscimo

From the man pages: [code] EINVAL Invalid value for cmd or semid. Or: for a SEM_STAT operation, the index value specified in semid referred to an array slot that is currently unused. [/code] My guess is that [icode]l[/icode] - wherever it is defined - is not suited to be a …

Member Avatar for noscimo
0
98
Member Avatar for fk123

You could always just get the entire line and split it up by spaces:[code]line = gets return unless line line.chomp.split(/\s+/).each do |token| puts "Token: #{token}" end[/code]which will give you something like: [code]1 2 3 4 5 # this is the input Token: 1 Token: 2 Token: 3 Token: 4 Token: …

Member Avatar for fk123
0
150
Member Avatar for marirs07

You can use an environment variable:[code]$cat Makefile something: @echo ${MY_VAR} [/code] Then you can do something like:[code]$ MY_VAR="DATA" make DATA $[/code]

Member Avatar for L7Sqr
0
153
Member Avatar for vedro-compota

Writing a linux driver is itself a non-trivial task. The topic is not meant for beginners so you will likely have trouble finding a basic tutorial. That being said, [url=http://tldp.org/LDP/lkmpg/2.6/html/]here[/url] is a step-by-step howto for creating a kernel module.

Member Avatar for vedro-compota
0
189
Member Avatar for ram619

It has to do with the way the call [icode]reverse(no--)[/icode] is being implemented. The post decrement operator allows for the variable to be used in it's context [i]before[/i] it is decremented. So, in your situation it is using the original value of [icode]no[/icode] for the recursive call and decrementing it …

Member Avatar for ram619
0
99
Member Avatar for fatalaccidents

Bash has a really convenient way to get to that argument. You can use [icode]!$[/icode] which refers to the last argument in the preceding command. Consider:[code]$ pwd /home/me $ cp blah.txt /some/other/location $ cd !$ $ pwd /some/other/location[/code]And, since you probably only want to be there temporarily you can push …

Member Avatar for fatalaccidents
0
243
Member Avatar for s.w.a

I'm not sure what you mean. If you are asking if the router is programmed using the Java programming language then the answer is likely no. Routers are designed to be as fast a possible at what they do. Generally speaking, Java doesn't provide the facilities to support things that …

Member Avatar for L7Sqr
0
2K
Member Avatar for surferxo3

First, it is not usually a good idea to shadow loop counter variables like you have. A quick read over your code [i]looks[/i] like you never reset [icode]i[/icode] after the first loop. As far as your logic, add a few print statements and you will see what is happening immediately: …

Member Avatar for Lerner
0
234
Member Avatar for maurya10

That statement doesnt make much sense. Do you want advice on how to program using [icode]awk[/icode] or would you like the source code to [i]build[/i] [icode]awk[/icode]?

Member Avatar for cfajohnson
0
95
Member Avatar for mrprassad

Perhaps this will help explain what the layout has to do with the output. If you compile the code to asm using [icode]gcc -S file.c[/icode] they you might see the following output:[code] .file "file.c" .section .rodata .LC0: .string "dcis" .LC1: .string "%s" .text[/code] Notice in the read-only section of the …

Member Avatar for Moschops
0
200
Member Avatar for silvercats

Since you mention that you are already reading a book on the topic you must have some idea of the answers to these questions. However, to address some of the points: TCP is distinct from IP. I will describe TCP here as I believe that is what you mean, although …

Member Avatar for silvercats
0
1K
Member Avatar for shubham.joy

Another case of the failed expanded macro. If you expand that macro you will get the following: [code]int main() { int i, j = 10; int k = 15; for( i = 0; i < j > k ? j:k; i++ ) { printf( "\nhi" ); } return 0; }[/code] …

Member Avatar for nezachem
0
246
Member Avatar for srinivas88

The nice thing about TCP is that it manages so much for you under the hood. The problem with TCP is that it manages so much for you under the hood. There is the possibility, due to the send window, that you can have data sent by the client and …

Member Avatar for srinivas88
0
401
Member Avatar for hekri

The [icode]#include[/icode] acts as a paste function for the file it targets. So when you say [icode]#include <ctime>[/icode], the file [icode]ctime[/icode] is located and it's contents are pasted directly in the place of the statement. What that [i]does[/i] is provide you with all of the declarations and code that is …

Member Avatar for hekri
0
3K
Member Avatar for matharoo

You can use a case statement to get what you are after. For example: [code]#!/bin/bash LOG=/dev/null while read line; do case ${line} in 'AIR DR') LOG='air_dr.out' ;; 'AIR UR') LOG='air_ur.out' ;; 'WATER DR') LOG='water_dr.out' ;; 'WATER UR') LOG='water_ur.out' ;; *) echo ${line} >> ${LOG} ;; esac done < results.txt[/code]

Member Avatar for L7Sqr
0
328
Member Avatar for manpreet87

Why [icode]awk[/icode]? Ruby (or similar scripting language) would make this trivial as there would be no need to modify the input line. For instance: [code=ruby]#!/usr/bin/env ruby require 'time' two_hours = 60 * 60 * 2 while line = gets ts = Time.parse(line.chomp) now = Time.now if now - ts < …

Member Avatar for L7Sqr
0
119
Member Avatar for Idestruction

If there is no need to store the data for later use in the file you might do better to use a socket or named pipe. Your application can write to the one end of the pipe and the php script can read from the other end when data is …

Member Avatar for L7Sqr
0
282
Member Avatar for Icostyle

And I need to know the next guy we hire has not farmed out his homework/tests to the internet. Thanks!

Member Avatar for L7Sqr
0
109
Member Avatar for dellat

How about [URL="http://ndk-xx.sourceforge.net/"]http://ndk-xx.sourceforge.net/[/URL]?

Member Avatar for dellat
0
599
Member Avatar for freedomflyer

It's unlikely that what you describe is happening. Consider[code]#include <cstring> #include <cstdio> const char url[] = "www.google.com/"; int main () { char * pos = strrchr (url, '/'); if (pos) { printf ("Found / in %s\n", url); } return 0; }[/code] I've run that 100 times each time the '/' …

Member Avatar for freedomflyer
0
205
Member Avatar for thecoolman5

How about [url=http://www.cplusplus.com/reference/string/string/find_first_not_of/]find_first_not_of[/url]?

Member Avatar for thecoolman5
0
633
Member Avatar for nijinjose123

I'm not sure what you mean by [i]readable[/i] values. Certainly hex is readable. I suppose you would like the number in a different [i]base[/i] than 16. If you are outputting to the screen then you can just format the output however you like since values are stored internally not related …

Member Avatar for nijinjose123
0
181
Member Avatar for mahesh113

[icode]popen[/icode] creates another process and manages the pipe setup for you. It calls [icode]fork[/icode] (in linux) and I'm not sure how the child process is executed in Windows. This is different than using something such as [icode]pthreads[/icode] to run multiple threads in the same process space.

Member Avatar for L7Sqr
0
247

The End.