Search Results

Search found 27946 results on 1118 pages for 'output buffer empty'.

Page 155/1118 | < Previous Page | 151 152 153 154 155 156 157 158 159 160 161 162  | Next Page >

  • Allocating memory in char * struct

    - by mrblippy
    hi, im trying to read in a word from a user, then dynamically allocate memory for the word and store it in a struct array that contains a char *. i keep getting a implicit declaration of function âstrlenâ so i know im going wrong somewhere. struct class { char class_code[7]; char *name; }; char buffer[101]; struct unit units[1000]; scanf("%s", buffer); units[0].name = (char *) malloc(strlen(buffer)+1); strcpy(units[0].name, buffer);

    Read the article

  • What does this C++ code mean

    - by Markus Orreilly
    I was trying to understand how webkit parses urls, and I'm having a hard time making heads or tails of this: Vector<char, 4096> buffer(fragmentEnd * 3 + 1); This line is on line 1214 (you can see it here: http://trac.webkit.org/browser/trunk/WebCore/platform/KURL.cpp#L1214). I get that it's making a vector of type char, with each entry being an array of char 4096 bytes large, but I don't get the buffer(fragmentEnd * 3 + 1) part. I think that it confuses me most b/c I can't find where the buffer variable is instantiated anywhere (shouldn't it be something more like Vector<char, 4096> buffer = new Vector<char, 4096>(...)? Thanks in advance

    Read the article

  • Allocating memory for a char pointer that is part of a struct

    - by mrblippy
    hi, im trying to read in a word from a user, then dynamically allocate memory for the word and store it in a struct array that contains a char *. i keep getting a implicit declaration of function âstrlenâ so i know im going wrong somewhere. struct class { char class_code[4]; char *name; }; char buffer[101]; struct unit units[1000]; scanf("%s", buffer); units[0].name = (char *) malloc(strlen(buffer)+1); strcpy(units[0].name, buffer);

    Read the article

  • How to create dynamic number of output files with SSIS?

    - by JSacksteder
    I will be creating flatfiles and based on the data in the batch, it might be necessary to split the data into an undetermined number of files. I can make the connection string dynamic with an expression, but that is only evaluated when the package starts. I'd like to change that expression to include a '-a' or '-b' in the filename. Alternately, if I have to create new connection manager objects at run time on demand, how do I go about that?

    Read the article

  • Read non-blocking from multiple fifos in parallel

    - by Ole Tange
    I sometimes sit with a bunch of output fifos from programs that run in parallel. I would like to merge these fifos. The naïve solution is: cat fifo* > output But this requires the first fifo to complete before reading the first byte from the second fifo, and this will block the parallel running programs. Another way is: (cat fifo1 & cat fifo2 & ... ) > output But this may mix the output thus getting half-lines in output. When reading from multiple fifos, there must be some rules for merging the files. Typically doing it on a line by line basis is enough for me, so I am looking for something that does: parallel_non_blocking_cat fifo* > output which will read from all fifos in parallel and merge the output on with a full line at a time. I can see it is not hard to write that program. All you need to do is: open all fifos do a blocking select on all of them read nonblocking from the fifo which has data into the buffer for that fifo if the buffer contains a full line (or record) then print out the line if all fifos are closed/eof: exit goto 2 So my question is not: can it be done? My question is: Is it done already and can I just install a tool that does this?

    Read the article

  • Read from file into pointer to struct

    - by cla barzu
    I need help with pointers in C. I have to read from a file, and fill an array with pointers to struct rcftp_msg . Since now I did the next things: struct rcftp_msg { uint8_t version; uint8_t flags; uint16_t len; uint8_t buffer[512]; }; struct rcftp_msg *windows [10]; pfile = fopen(file,"r"); // Open the file I have to read from the file into the buffer, but I don't know how to do it. I tried the next: for (i = 0; i <10; i++){ leng=fread (**windows[i]->buffer**,sizeof(uint8_t),512,pfile); } I think windows[i]-buffer is bad, cuz that don't work. Sorry for my bad English :(

    Read the article

  • emacs: interactively search open buffers

    - by Data
    Is there a way to search all the open buffers for a particular pattern. C-s interactively searches current buffer. Similarly, is there something, that searches all the open buffers. I know I can use "occur", but "Occur" brings a new buffer and changes/messes the buffer organization.

    Read the article

  • How to output list of float text to binary file in Perl ?

    - by YoDar
    Hi, I have text file looks like that: float a[10] = { 7.100000e+000 , 9.100000e+000 , 2.100000e+000 , 1.100000e+000 , 8.200000e+000 , 7.220000e+000 , 7.220000e+000 , 7.222000e+000 , 1.120000e+000 , 1.987600e+000 }; unsigned int col_ind[10] = { 1 , 4 , 3 , 4 , 5 , 2 , 3 , 4 , 1 , 5 }; Now, I want to convert each array (float / unsigned int) to different binary files - big endian type. Binary file for all float values and binary file for all integer values. What is the simple way to do it in Perl, consider I have over 2 millon elements in each array? Thanks, Yodar.

    Read the article

  • How do I conditionally redirect the output of a command to /dev/null?

    - by Lawrence Johnston
    I have a script. I would like to give this script a quiet mode and a verbose mode. This is the equivalent of: if $verbose then redirect="> /dev/null" fi echo "Verbose mode enabled" $redirect # This doesn't work because the redirect isn't evaluated. I'd really like a better way of doing this than writing if-elses for every statement affected. eval could work, but has obvious side effects on other variables.

    Read the article

  • Template neglects const (why?)

    - by Gabriel
    Does somebody know, why this compiles?? template< typename TBufferTypeFront, typename TBufferTypeBack = TBufferTypeFront> class FrontBackBuffer{ public: FrontBackBuffer( const TBufferTypeFront front, const TBufferTypeBack back): ////const reference assigned to reference??? m_Front(front), m_Back(back) { }; ~FrontBackBuffer() {}; TBufferTypeFront m_Front; ///< The front buffer TBufferTypeBack m_Back; ///< The back buffer }; int main(){ int b; int a; FrontBackBuffer<int&,int&> buffer(a,b); // buffer.m_Back = 33; buffer.m_Front = 55; } I compile with GCC 4.4. Why does it even let me compile this? Shouldn't there be an error that I cannot assign a const reference to a non-const reference?

    Read the article

  • How do you label output variables in an IDL FOR loop for further processing outside the loop in the same program?

    - by user610769
    I have a FOR loop like this: FOR k = 1,216 DO atom = G[,0::(215+k)] END What I would like to be able to do is to store in memory the array for each atom, say, atom_k and then call these different variables to perform further operations outside the FOR loop. Conceptually, I want to label the "atom" variable with the "k" counter somewhat like this: FOR k = 1,216 DO atom(k) = G[,0::(215+k)] END Of course, this doesn't work because "k" is no longer a label in this case. Does anyone know?

    Read the article

  • Can you embed PHP code in the output of a CGI script?

    - by Joe Corkery
    I have a CGI based form that I am working with and I would like to be able to include some PHP code in the generated results. However, when I do this, the PHP does not appear to get processed and just ends up being displayed in the resulting web page. Is what I am doing actually possible or am I missing something? Thanks.

    Read the article

  • How would i output a message that says "values inserted to table" ?

    - by ranlo
    <?php error_reporting(0); $con=mysql_connect("localhost","root",""); if (!$con) { die('could not connect:'.mysql_error()); } mysql_select_db("final?orgdocs",$con); $org_name = $_POST["org_name"]; $org_type = $_POST["org_type"]; $org_code = $_POST["org_code"]; $description = $_POST["description"]; $stmt = "INSERT INTO organization VALUES('".$org_name."','".$org_type."','".$org_code."','".$description."')"; $result = mysql_query("SELECT * FROM organization WHERE org_name = '$org_name' "); echo '<TABLE BORDER = "1">'; $result1 = $result; while ($row = mysql_fetch_array($result1)){ echo '<TR>'.'<TD>'.'Organization Name'.'</TD>'.'<TD>'.'Organization Type'.'</TD>'.'<TD>'.'Organization Code'.'</TD>'.'<TD>'.'Description'.'</TD>'.'<TD>'.'Constitution'.'</TD>'; echo '</TR>'; echo '<TR>'.'<TD>'.$row['org_name'].'</TD>'.'<TD>'.$row['org_type'].'</TD>'; echo '<TD>'.$row['org_code'].'</TD>'.'<TD>'.$row['description'].'</TD>'.'<TD>'; echo '</TR>'; } echo '</TABLE>'; ?>

    Read the article

  • Output Caching with IIS7 - How To for a dynamic aspx page?

    - by Lieven Cardoen
    I have a RetrieveBlob.aspx that gets some query string variables and returns an asset. Eeach url corresponds to a unique asset. In the RetrieveBlob.aspx a Cache Profile is set. In Web.Config the profile looks like (under system.web tag): <caching> <outputCache enableOutputCache="true" /> <outputCacheSettings> <outputCacheProfiles> <add duration="14800" enabled="true" varyByParam="*" name="AssetCacheProfile" /> </outputCacheProfiles> </outputCacheSettings> </caching> Ok, this works fine. When I put a breakpoint in the code behind of RetrieveBlob.aspx, it gets triggered the first time, and all the other times not. Now, I throw away the Cache Profile and instead I'm having this in my Web.Config under System.WebServer: <caching> <profiles> <add extension=".swf" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="00:08:00" /> <add extension=".flv" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="00:08:00" /> <add extension=".gif" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="00:08:00" /> <add extension=".png" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="00:08:00" /> <add extension=".mp3" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="00:08:00" /> <add extension=".jpeg" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="00:08:00" /> <add extension=".jpg" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="00:08:00" /> </profiles> </caching> Now the caching doesn't work anymore. What am I doing wrong? Is it possible to configure under Caching tag of System.WebServer a Caching Profile for a Dynamic aspx page? I already tried adding something like this: <add extension="RetrieveBlob.aspx" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="00:00:30" varyByQueryString="assetId, assetFileId" /> But it doesn't work. An example of an url is: http://{server}/{application}/trunk/RetrieveBlob.aspx?assetId=31809&assetFileId=11829

    Read the article

  • Image URL has the contentType "text/html"

    - by user1503025
    I want to implement a method to download Image from website to laptop. public static void DownloadRemoteImageFile(string uri, string fileName) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); if ((response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.Moved || response.StatusCode == HttpStatusCode.Redirect) && response.ContentType.StartsWith("image", StringComparison.OrdinalIgnoreCase)) { //if the remote file was found, download it using (Stream inputStream = response.GetResponseStream()) using (Stream outputStream = File.OpenWrite(fileName)) { byte[] buffer = new byte[4096]; int bytesRead; do { bytesRead = inputStream.Read(buffer, 0, buffer.Length); outputStream.Write(buffer, 0, bytesRead); } while (bytesRead != 0); } } } But the ContentType of request or response is not "image/jpg" or "image/png". They're always "text/html". I think that's why after I save them to local, they has incorrect content and I cannot view them. Can anyone has a solution here? Thanks

    Read the article

  • How to optimize this simple function which translates input bits into words?

    - by psihodelia
    I have written a function which reads an input buffer of bytes and produces an output buffer of words where every word can be either 0x0081 for each ON bit of the input buffer or 0x007F for each OFF bit. The length of the input buffer is given. Both arrays have enough physical place. I also have about 2Kbyte free RAM which I can use for lookup tables or so. Now, I found that this function is my bottleneck in a real time application. It will be called very frequently. Can you please suggest a way how to optimize this function? I see one possibility could be to use only one buffer and do in-place substitution. void inline BitsToWords(int8 *pc_BufIn, int16 *pw_BufOut, int32 BufInLen) { int32 i,j,z=0; for(i=0; i<BufInLen; i++) { for(j=0; j<8; j++, z++) { pw_BufOut[z] = ( ((pc_BufIn[i] >> (7-j))&0x01) == 1? 0x0081: 0x007f ); } } } Please do not offer any compiler specific or CPU/Hardware specific optimization, because it is a multi-platform project.

    Read the article

  • Downloading Large JSON File to local file using Java

    - by user1279675
    I'm attempting to download a JSON from the following URL - http://api.crunchbase.com/v/1/companies.js - to a local file. I'm using Java 1.7 and the following JSON Libraries - http://www.json.org/java/ - to attempt to make it work. Here's my code: public static void download(String address, String localFileName) { OutputStream out = null; URLConnection conn = null; InputStream in = null; try { URL url = new URL(address); out = new BufferedOutputStream( new FileOutputStream(localFileName)); conn = url.openConnection(); in = conn.getInputStream(); byte[] buffer = new byte[1024]; int numRead; long numWritten = 0; while ((numRead = in.read(buffer)) != -1) { out.write(buffer, 0, numRead); numWritten += numRead; System.out.println(buffer.length); System.out.println(" " + buffer.hashCode()); } System.out.println(localFileName + "\t" + numWritten); } catch (Exception exception) { exception.printStackTrace(); } finally { try { if (in != null) { in.close(); } if (out != null) { out.close(); } } catch (IOException ioe) { } } } When I run the code everything seems to work until midway through the loop the program seems to stop and not continue reading the JSON Object. Does anyone know why this would stop reading? How could I fix the issue?

    Read the article

  • Circular increment: Which is "better"?

    - by Helper Method
    When you have a circular buffer represented as an array, and you need the index to wraparound (i.e., when you reach the highest possible index and increment it), is it "better" to: return (i++ == buffer.length) ? 0: i; Or return i++ % buffer.length; Has using the modulo operator any drawbacks? Is it less readable than the first solution?

    Read the article

< Previous Page | 151 152 153 154 155 156 157 158 159 160 161 162  | Next Page >