Search Results

Search found 3516 results on 141 pages for 'malloc history'.

Page 1/141 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • The History Of Operating Systems [Infographic]

    - by ETC
    Earlier this week we shared a history of operating system names with you. This infographic complements that with a timeline of quotes and facts from the annals of computer history. Hit up the link below to check out the full infographic. The History Of Operating Systems [MakeUseOf] Latest Features How-To Geek ETC Have You Ever Wondered How Your Operating System Got Its Name? Should You Delete Windows 7 Service Pack Backup Files to Save Space? What Can Super Mario Teach Us About Graphics Technology? Windows 7 Service Pack 1 is Released: But Should You Install It? How To Make Hundreds of Complex Photo Edits in Seconds With Photoshop Actions How to Enable User-Specific Wireless Networks in Windows 7 The History Of Operating Systems [Infographic] DriveSafe.ly Reads Your Text Messages Aloud The Likability of Angry Birds [Infographic] Dim an Overly Bright Alarm Clock with a Binder Divider Preliminary List of Keyboard Shortcuts for Unity Now Available Bring a Touch of the Wild West to Your Desktop with the Rango Theme for Windows 7

    Read the article

  • This Week in Geek History: NORAD Tracks Santa, First HTTP Test, Babbage’s Birthday

    - by Jason Fitzpatrick
    History trivia shouldn’t be limited to just treaty dates and wars ending, we’re marking off major milestones in geek history—one week at at time. This week in history we’ve got Santa on the Cold War radar, baby HTTP going for a spin, and Babbage’s birth to help usher in the age of computers. Latest Features How-To Geek ETC How to Use the Avira Rescue CD to Clean Your Infected PC The Complete List of iPad Tips, Tricks, and Tutorials Is Your Desktop Printer More Expensive Than Printing Services? 20 OS X Keyboard Shortcuts You Might Not Know HTG Explains: Which Linux File System Should You Choose? HTG Explains: Why Does Photo Paper Improve Print Quality? An Alternate Star Wars Christmas Special [Video] Sunset in a Tropical Paradise Wallpaper Natural Wood Grain Icons for Your Desktop and App Launcher Docks My Blackberry Is Not Working! The Apple Too?! [Funny Video] Hidden Tracks Your Stolen Mac; Free Until End of January Why the Other Checkout Line Always Moves Faster

    Read the article

  • Our Narrow Slice – Looking at History from a Different Perspective

    - by Akemi Iwaya
    When we learn about places, people, and events from history, we are usually taught about them in separate chunks or blocks, making them ‘seem’ rather separate and/or disconnected from each other. Vsauce provides a new perspective about some famous people, places, and events from history that you may not have known about or thought of as simultaneous/connected. Our Narrow Slice [YouTube]     

    Read the article

  • This Week in Geek History: Birth of Linux Creator, FM Radio Appears, and Q*Bert Released

    - by Jason Fitzpatrick
    Every week we bring you interesting trivia from the annuals of geekdom. This week in Geek History witnessed the birth of Linux creator Linus Torvalds, the patent for FM radio, and the release of wildly popular 80s arcade game Q*Bert. Read on to learn more about each event. Latest Features How-To Geek ETC The 20 Best How-To Geek Explainer Topics for 2010 How to Disable Caps Lock Key in Windows 7 or Vista How to Use the Avira Rescue CD to Clean Your Infected PC The Complete List of iPad Tips, Tricks, and Tutorials Is Your Desktop Printer More Expensive Than Printing Services? 20 OS X Keyboard Shortcuts You Might Not Know Classic Super Mario Brothers Theme for Chrome and Iron Experimental Firefox Builds Put Tabs on the Title Bar (Available for Download) Android Trojan Found in the Wild Chaos, Panic, and Disorder Wallpaper Enjoy Christmas Beyond the Holiday with Christmas Eve Crisis Parrotfish Extends the Number of Services Accessible in Twitter Previews

    Read the article

  • Retrieving Chrome History and History Archives for Mac

    - by Justin
    I've read some articles here that suggest that we are able to retrieve Chrome's history as SQLite databases: Export history from chome browser How can I view "archived" Google Chrome history — i.e. history older than three months? I can't seem to find the folder where these are supposed to be located. In the first article, the provided path was ~/Library/Application\ Support/Google/Chrome/Default/History, but there is no such directory in my filesystem. I am using Chrome 26.0.1410.65 on Mac OS X Lion. And I am signed in with my Google account. Article http://unlockforus.blogspot.it/2008/09/how-opening-google-chrome-files-history.html provided in the last of the above is very useful, but it is only for Windows. Is there something similar to that but for Mac? Is there a way to find the folder where Chrome stores my history?

    Read the article

  • Jquery history, inspect the history stack

    - by nickmorss
    Im using this history jquery plugin http://www.mikage.to/jquery/jquery_history.html and im trying to inspect the back stack. I can call this $.historyCurrentHash to return the current hash, but im trying to figure out how to look one step back in the stack. if i try calling this $.historyBackStack, but i just get an 'undefined'. anyone got any ideas? I can see that its not a public variable, but im wondering if i need to modify the library or just call it in a different way

    Read the article

  • Explore Historic Sites from the Comfort of Your Desktop with Google’s ‘World Wonders Project’

    - by Asian Angel
    Have you always wanted to explore historic sites across the world but lack the extra time and/or funds to do so? Then take heart! Now you can visit historic sites to your heart’s content from home with Google’s ‘World Wonders Project’. Note: The screenshot shown above is from the ‘Archaeological Areas of Pompei’ site. You can explore exotic locations such as Pompei, the Palace and Park of Versailles, Shark Bay, the Tenryu-ji-Temple in Ancient Kyoto, and more. The World Wonders Project Homepage The World Wonders Project YouTube Channel HTG Explains: Learn How Websites Are Tracking You Online Here’s How to Download Windows 8 Release Preview Right Now HTG Explains: Why Linux Doesn’t Need Defragmenting

    Read the article

  • How to get shared bashed history among different tabs

    - by Luca Cerone
    I used the answer in http://unix.stackexchange.com/a/1292/41729 to enable real-time shared history among separate bash terminals. As explained in the answer above, this is achieved by adding: # avoid duplicates.. export HISTCONTROL=ignoredups:erasedups # append history entries.. shopt -s histappend # After each command, save and reload history export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" This works fine if the bash shells are separate (e.g. opening different bash terminals using CTRL+ALT+T. However it doesn't work if I use tabs (from an open terminal `CTRL+SHIFT+T) rather than new windows. Why this difference in behaviour? How can I share the bash history also among various tabs?

    Read the article

  • Implementing History Support using jQuery for AJAX websites built on asp.net AJAX

    - by anil.kasalanati
    Problem Statement: Most modern day website use AJAX for page navigation and gone are the days of complete HTTP redirection so it is imperative that we support back and forward buttons on the browser so that end users navigation is not broken. In this article we discuss about solutions which are already available and problems with them. Microsoft History Support: Post .Net 3.5 sp1 Microsoft’s Script manager supports history for websites using Update panels. This is achieved by enabling the ENABLE HISTORY property for the script manager and then the event “Page_Browser_Navigate” needs to be handled. So whenever the browser buttons are clicked the event is fired and the application can write code to do the navigation. The following articles provide good tutorials on how to do that http://www.asp.net/aspnet-in-net-35-sp1/videos/introduction-to-aspnet-ajax-history http://www.codeproject.com/KB/aspnet/ajaxhistorymanagement.aspx And Microsoft api internally creates an IFrame and changes the bookmark of the url. Unfortunately this has a bug and it does not work in Ie6 and 7 which are the major browsers but it works in ie8 and Firefox. And Microsoft has apparently fixed this bug in .Net 4.0. Following is the blog http://weblogs.asp.net/joshclose/archive/2008/11/11/asp-net-ajax-addhistorypoint-bug.aspx For solutions which are still running on .net 3.5 sp1 there is no solution which Microsoft offers so there is  are two way to solve this o   Disable the back button. o   Develop custom solution.   Disable back button Even though this might look like a very simple thing to do there are issues around doing this  because there is no event which can be manipulated from the javascript. The browser does not provide an api to do this. So most of the technical solution on internet offer work arounds like doing a history.forward(1) so that even if the user clicks a back button the destination page redirects the user to the original page. This is not a good customer experience and does not work for asp.net website where there are different views in the same page. There are other ways around detecting the window unload events and writing code there. So there are 2 events onbeforeUnload and onUnload and we can write code to show a confirmation message to the user. If we write code in onUnLoad then we can only show a message but it is too late to stop the navigation. And if we write on onBeforeUnLoad we can stop the navigation if the user clicks cancel but this event would be triggered for all AJAX calls and hyperlinks where the href is anything other than #. We can do this but the website has to be checked properly to ensure there are no links where href is not # otherwise the user would see a popup message saying “you are leaving the website”. Believe me after doing a lot of research on the back button disable I found it easier to support it rather than disabling the button. So I am going to discuss a solution which work  using jQuery with some tweaking. Custom Solution JQuery already provides an api to manage the history of a AJAX website - http://plugins.jquery.com/project/history We need to integrate this with Microsoft Page request manager so that both of them work in tandem. The page state is maintained in the cookie so that it can be passed to the server and I used jQuery cookie plug in for that – http://plugins.jquery.com/node/1386/release Firstly when the page loads there is a need to hook up all the events on the page which needs to cause browser history and following is the code to that. jQuery(document).ready(function() {             // Initialize history plugin.             // The callback is called at once by present location.hash.             jQuery.history.init(pageload);               // set onlick event for buttons             jQuery("a[@rel='history']").click(function() {                 //                 var hash = this.page;                 hash = hash.replace(/^.*#/, '');                 isAsyncPostBack = true;                 // moves to a new page.                 // pageload is called at once.                 jQuery.history.load(hash);                 return true;             });         }); The above scripts basically gets all the DOM objects which have the attribute rel=”history” and add the event. In our test page we have the link button  which has the attribute rel set to history. <asp:LinkButton ID="Previous" rel="history" runat="server" onclick="PreviousOnClick">Previous</asp:LinkButton> <asp:LinkButton ID="AsyncPostBack" rel="history" runat="server" onclick="NextOnClick">Next</asp:LinkButton> <asp:LinkButton ID="HistoryLinkButton" runat="server" style="display:none" onclick="HistoryOnClick"></asp:LinkButton>   And you can see that there is an hidden HistoryLinkButton which used to send a sever side postback in case of browser back or previous buttons. And note that we need to use display:none and not visible= false because asp.net AJAX would disallow any post backs if visible=false. And in general the pageload event get executed on the client side when a back or forward is pressed and the function is shown below function pageload(hash) {                   if (hash) {                         if (!isAsyncPostBack) {                           jQuery.cookie("page", hash);                     __doPostBack("HistoryLinkButton", "");                 }                isAsyncPostBack = false;                             } else {                 // start page             jQuery("#load").empty();             }         }   As you can see in case there is an hash in the url we are basically do an asp.net AJAX post back using the following statement __doPostBack("HistoryLinkButton", ""); So whenever the user clicks back or forward the post back happens using the event statement we provide and Previous event code is invoked in the code behind.  We need to have the code to use the pageId present in the url to change the page content. And there is an important thing to note – because the hash is worked out using the pageId’s there is a need to recalculate the hash after every AJAX post back so following code is plugged in function ReWorkHash() {             jQuery("a[@rel='history']").unbind("click");             jQuery("a[@rel='history']").click(function() {                 //                 var hash = jQuery(this).attr("page");                 hash = hash.replace(/^.*#/, '');                 jQuery.cookie("page", hash);                 isAsyncPostBack = true;                                   // moves to a new page.                 // pageload is called at once.                 jQuery.history.load(hash);                 return true;             });        }   This code is executed from the code behind using ScriptManager RegisterClientScriptBlock as shown below –       ScriptManager.RegisterClientScriptBlock(this, typeof(_Default), "Recalculater", "ReWorkHash();", true);   A sample application is available to be downloaded at the following location – http://techconsulting.vpscustomer.com/Source/HistoryTest.zip And a working sample is available at – http://techconsulting.vpscustomer.com/Samples/Default.aspx

    Read the article

  • Visual History for Chrome Maps Out Your Browser History in an Interactive Graph

    - by Jason Fitzpatrick
    Curious how your adventures on the web interweave? Visual History for Chrome maps out related web sites in your browsing history into an interactive chart–visualize your browsing over the last hours, days, or months. One of the interesting elements of Visual History is that it doesn’t simply link sites together via activated hyperlinks but by consecutive use within 20 minute increments–thus if you frequently hit up Gmail, Facebook, and Reddit first thing in the morning, they’ll all appear together in a usage cluster. Site can be organized by URL, sub-domain, or domain. Visual History is free, Chrome only. Visual History for Chrome [Chrome Web Store] HTG Explains: What The Windows Event Viewer Is and How You Can Use It HTG Explains: How Windows Uses The Task Scheduler for System Tasks HTG Explains: Why Do Hard Drives Show the Wrong Capacity in Windows?

    Read the article

  • Menu tab completion for recent history in zsh

    - by dat5h
    I am interested in a potential zle widget for zsh. Is there a way to build a widget that mimics the kill-completion selectable menu? Essentially I want to be able to press , tab in vi-command-mode, or maybe !-tab-completion at the shell and get a list of recent history (or related history compared what is already entered at the commandline) that allows me to scroll through it and possibly select a relevant function to call or compare similar calls. Looking through the manual I stumbled onto a similar widget that I have mapped like so: # tab completion history menu (vicmd) autoload -z history-beginning-search-menu zle -N history-beginning-search-menu-space-end history-beginning-search-menu bindkey -M vicmd "\t" history-beginning-search-menu-space-end # emacs binding could be "\e\t"? (I wouldn't know) Therefore, if I enter vicmd and hit tab when I enter something like "grep", then I get a list of all grep calls in history. It also asks me for the list-number and it will perform the numbered item in history. If I enter a space and then try this, it lists ALL of my history history. This is fairly close to what I want, but there are some problems. For example, 1) it prints the entire list of relevant history and does not check the number of lines of the screen so it could easily blow up the space on the terminal; 2) when I type in numbers for selecting an item in history it does not show me the numbers I type, so I may make a mistake and have to start over again; 3) I would love to be able to hook in appearance tweaks. I was wondering if there exists more updated version of this widget or if there is any way to look at the source for kill-completion or history-beginning-search-menu to see if I could think of a way to do it.

    Read the article

  • Bash history handling with multiple terminals

    - by zetah
    I use mainly Terminator, and it's usually opened with 3 split terminal windows. I also use Gnome terminal for various reasons. I'm wondering how is bash history handled in this case as I sometimes miss previously issued commands when I run history For example, my prompt shows current bash history line (\!) and if I launch Terminator with 3 split terminal windows I get same history line (let's say 100) on all terminals. Which history will be saved? Also launching Gnome Terminal after using Terminator I get line 100 at startup regardless all commands issued before in Terminator

    Read the article

  • This Week In Geek History: Steve Jobs Demos the First Mac, Mythbusters Hits the Airwaves, and Dr. Strangelove Invades Popular Culture

    - by Jason Fitzpatrick
    It was quite a wild ride for this week in Geek History: Steve Jobs gave a demonstration of the first Macintosh computer, beloved geek show MythBusters took to the air, and iconic movie Dr. Strangelove appeared in theatres and our collective consciousness. Latest Features How-To Geek ETC How To Create Your Own Custom ASCII Art from Any Image How To Process Camera Raw Without Paying for Adobe Photoshop How Do You Block Annoying Text Message (SMS) Spam? How to Use and Master the Notoriously Difficult Pen Tool in Photoshop HTG Explains: What Are the Differences Between All Those Audio Formats? How To Use Layer Masks and Vector Masks to Remove Complex Backgrounds in Photoshop Bring Summer Back to Your Desktop with the LandscapeTheme for Chrome and Iron The Prospector – Home Dash Extension Creates a Whole New Browsing Experience in Firefox KinEmote Links Kinect to Windows Why Nobody Reads Web Site Privacy Policies [Infographic] Asian Temple in the Snow Wallpaper 10 Weird Gaming Records from the Guinness Book

    Read the article

  • This Week in Geek History: Zelda Turns 25, Birth of the Printing Press, and the Unveiling of ENIAC

    - by Jason Fitzpatrick
    Every week we bring you interesting highlights from the history of geekdom. This week we take a look at The Legend of Zelda’s 25th anniversary, the Gutenberg press, and the unveiling of primitive super computer ENIAC. Latest Features How-To Geek ETC Should You Delete Windows 7 Service Pack Backup Files to Save Space? What Can Super Mario Teach Us About Graphics Technology? Windows 7 Service Pack 1 is Released: But Should You Install It? How To Make Hundreds of Complex Photo Edits in Seconds With Photoshop Actions How to Enable User-Specific Wireless Networks in Windows 7 How to Use Google Chrome as Your Default PDF Reader (the Easy Way) Reclaim Vertical UI Space by Moving Your Tabs to the Side in Firefox Wind and Water: Puzzle Battles – An Awesome Game for Linux and Windows How Star Wars Changed the World [Infographic] Tabs Visual Manager Adds Thumbnailed Tab Switching to Chrome Daisies and Rye Swaying in the Summer Wind Wallpaper Read On Phone Pushes Data from Your Desktop to the Appropriate Android App

    Read the article

  • bash doesn't keep history

    - by yohbs
    I run Ubuntu 12.04, and for some reason bash does not keep my command history. the ~/.bash_history file contains only 3 commands that I typed a few months ago. How can I fix this? EDIT: here's the relevant content of my .bashrc: # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples # If not running interactively, don't do anything [ -z "$PS1" ] && return # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000

    Read the article

  • How can I malloc an array of struct to do the following using file operation?

    - by RHN
    How can malloc an array of struct to do the following using file operation? the file is .txt input in the file is like: 10 22 3.3 33 4.4 I want to read the first line from the file and then I want to malloc an array of input structures equal to the number of lines to be read in from the file. Then I want to read in the data from the file and into the array of structures malloc. Later on I want to store the size of the array into the input variable size. return an array.After this I want to create another function that print out the data in the input variable in the same form like input file and suppose a function call clean_data will free the malloc memory at the end. I have tried somthing like: struct input { int a; float b,c; } struct input* readData(char *filename,int *size); int main() { return 0; } struct input* readData(char *filename,int *size) { char filename[] = "input.txt"; FILE *fp = fopen(filename, "r"); int num; while(!feof(fp)) { fscanf(fp,"%f", &num); struct input *arr = (struct input*)malloc(sizeof(struct input)); } }

    Read the article

  • Wrapping malloc - C

    - by Appu
    I am a beginner in C. While reading git's source code, I found this wrapper function around malloc. void *xmalloc(size_t size) { void *ret = malloc(size); if (!ret && !size) ret = malloc(1); if (!ret) { release_pack_memory(size, -1); ret = malloc(size); if (!ret && !size) ret = malloc(1); if (!ret) die("Out of memory, malloc failed"); } #ifdef XMALLOC_POISON memset(ret, 0xA5, size); #endif return ret; } Questions I couldn't understand why are they using malloc(1)? What does release_pack_memory does and I can't find this functions implementation in the whole source code. What does the #ifdef XMALLOC_POISON memset(ret, 0xA5, size); does? I am planning to reuse this function on my project. Is this a good wrapper around malloc? Any help would be great.

    Read the article

  • calloc v/s malloc and time efficiency

    - by yCalleecharan
    Hi, I've read with interest the post "c difference between malloc and calloc". I'm using malloc in my code and would like to know what difference I'll have using calloc instead. My present (pseudo)code with malloc: Scenario 1 int main() { allocate large arrays with malloc INITIALIZE ALL ARRAY ELEMENTS TO ZERO for loop //say 1000 times do something and write results to arrays end for loop FREE ARRAYS with free command } //end main If I use calloc instead of malloc, then I'll have: Scenario2 int main() { for loop //say 1000 times ALLOCATION OF ARRAYS WITH CALLOC do something and write results to arrays FREE ARRAYS with free command end for loop } //end main I have three questions: Which of the scenarios is more efficient if the arrays are very large? Which of the scenarios will be more time efficient if the arrays are very large? In both scenarios,I'm just writing to arrays in the sense that for any given iteration in the for loop, I'm writing each array sequentially from the first element to the last element. The important question: If I'm using malloc as in scenario 1, then is it necessary that I initialize the elements to zero? Say with malloc I have array z = [garbage1, garbage2, garbage 3]. For each iteration, I'm writing elements sequentially i.e. in the first iteration I get z =[some_result, garbage2, garbage3], in the second iteration I get in the first iteration I get z =[some_result, another_result, garbage3] and so on, then do I need specifically to initialize my arrays after malloc?

    Read the article

  • Malloc corrupting already malloc'd memory in C

    - by Kyte
    I'm currently helping a friend debug a program of his, which includes linked lists. His list structure is pretty simple: typedef struct nodo{ int cantUnos; char* numBin; struct nodo* sig; }Nodo; We've got the following code snippet: void insNodo(Nodo** lista, char* auxBin, int auxCantUnos){ printf("*******Insertando\n"); int i; if (*lista) printf("DecInt*%p->%p\n", *lista, (*lista)->sig); Nodo* insert = (Nodo*)malloc(sizeof(Nodo*)); if (*lista) printf("Malloc*%p->%p\n", *lista, (*lista)->sig); insert->cantUnos = auxCantUnos; insert->numBin = (char*)malloc(strlen(auxBin)*sizeof(char)); for(i=0 ; i<strlen(auxBin) ; i++) insert->numBin[i] = auxBin[i]; insert-numBin[i] = '\0'; insert-sig = NULL; Nodo* aux; [etc] (The lines with extra indentation were my addition for debug purposes) This yields me the following: *******Insertando DecInt*00341098->00000000 Malloc*00341098->2832B6EE (*lista)-sig is previously and deliberately set as NULL, which checks out until here, and fixed a potential buffer overflow (he'd forgotten to copy the NULL-terminator in insert-numBin). I can't think of a single reason why'd that happen, nor I've got any idea on what else should I provide as further info. (Compiling on latest stable MinGW under fully-patched Windows 7, friend's using MinGW under Windows XP. On my machine, at least, in only happens when GDB's not attached.) Any ideas? Suggestions? Possible exorcism techniques? (Current hack is copying the sig pointer to a temp variable and restore it after malloc. It breaks anyways. Turns out the 2nd malloc corrupts it too. Interestingly enough, it resets sig to the exact same value as the first one).

    Read the article

  • Bash command history not working

    - by user12663
    The command history between sessions is not getting saved. I'm using guake and the history for the session is working fine. I noticed that .bash_history had some commands I executed in sudo -s mode and tried the same again and all the commands while in the session got saved so I tried chmod 777 .bash_history Now the old commands appear at the start of a session but no new commands are getting saved Thanx in advance

    Read the article

  • Bash command history not working

    - by creepylol
    The command history between sessions is not getting saved. I'm using guake and the history for the session is working fine. I noticed that .bash_history had some commands I executed in "sudo -s" mode and tried the same again and all the commands while in the session got saved so I tried "chmod 777 .bash_history" Now the old commands appear at the start of a session but no new commands are getting saved Thanx in advance

    Read the article

  • How to save terminal history manually?

    - by wim
    It's my understanding that the history file is updated when the terminal exits. But sometimes my computer crashes out, and the terminal doesn't exit cleanly, and then I lose those commands from my history which is annoying. How can I make it flush immediately, so that the entries still go there even if my computer has a meltdown? At the moment I'm using this workaround, but I feel there should be a better way. I'm using gnome-terminal on Ubuntu 12.10.

    Read the article

  • Manage a `visited` links history in browsers

    - by osgx
    Hello Can I edit the browser's visited links history? How can I dump full list of visited sites, or list of pages from some site? I'm interested in the solution for the most popular browsers: IE7-8, Firefox3, Safari4, Chrome3, Opera9.50+ The best will be solution, which can be scripted in JS+CSS. But plugins or instructions for managing visited links history will be good. Thanks

    Read the article

  • c programming malloc question

    - by user535256
    Hello guys, Just got query regarding c malloc() function. I am read()ing x number of bytes from a file to get lenght of filename, like ' read(file, &namelen, sizeof(unsigned char)); ' . The variable namelen is a type unsigned char and was written into file as that type (1 byte). Now namelen has the lenght of filename ie namelen=8 if file name was 'data.txt', plus extra /0 at end, that working fine. Now I have a structure recording file info, ie filename, filelenght, content size etc. struct fileinfo { char *name; ...... other variable like size etc }; struct fileinfo *files; Question: I want to make that files.name variable the size of namelen ie 8 so I can successfully write the filename into it, like ' files[i].name = malloc(namelen) ' However, I dont want it to be malloc(sizeof(namelen)) as that would make it file.name[1] as the size of its type unsigned char. I want it to be the value thats stored inside variable &namelen ie 8 so file.name[8] so data.txt can be read() from file as 8 bytes and written straight into file.name[8? Is there a way to do this my current code is this and returns 4 not 8 files[i].name = malloc(namelen); //strlen(files[i].name) - returns 4 //perhaps something like malloc(sizeof(&namelen)) but does not work Thanks for any suggestions Have tried suggested suggestions guys, but I now get a segmentation fault error using: printf("\nsizeofnamelen=%x\n",namelen); //gives 8 for data.txt files[i].name = malloc(namelen + 1); read(file, &files[i].name, namelen); int len=strlen(files[i].name); printf("\nnamelen=%d",len); printf("\nname=%s\n",files[i].name); When I try to open() file with that files[i].name variable it wont open so the data does not appear to be getting written inside the read() &files[i].name and strlen() causes segemntation error as well as trying to print the filename

    Read the article

  • This Week in Geek History: Morse Code, Mars Rovers, J.R.R. Tolkien’s Birthday

    - by Jason Fitzpatrick
    Every week we bring you interesting facts from the history of Geekdom. This week in Geek History witnessed the first successful demonstration of the electric telegraph, the safe landing of the Spirit rover on the surface of Mars, and the birth of famed fantasy author J.R.R. Tolkien. Latest Features How-To Geek ETC How To Boot 10 Different Live CDs From 1 USB Flash Drive The 20 Best How-To Geek Linux Articles of 2010 The 50 Best How-To Geek Windows Articles of 2010 The 20 Best How-To Geek Explainer Topics for 2010 How to Disable Caps Lock Key in Windows 7 or Vista How to Use the Avira Rescue CD to Clean Your Infected PC The Deep – Awesome Use of Metal Objects as Deep Sea Creatures [Video] Convert or View Documents Online Easily with Zoho, No Account Required Build a Floor Scrubbing Robot out of Computer Fans and a Frisbee Serene Blue Windows Wallpaper for Your Desktop 2011 International Space Station Calendar Available for Download (Free) Ultimate Elimination – Lego Black Ops [Video]

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >