Help! Arrays

This is a discussion on Help! Arrays within the C Programming forums, part of the General Programming Boards category; Hey programmers! Iím doing a project, and for the last few weeks Iíve been completely stuck on 2 criteria. Ive ...

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    3

    Help! Arrays

    Hey programmers!

    Iím doing a project, and for the last few weeks Iíve been completely stuck on 2 criteria. Ive searched through both my books, royce/the ansi c progamming language. Multiple forums and still now hope.

    The first one is that i need to read a 1 MB data array from memory and write it to the local COM port.

    The second one is getting a file, in windows to save to USB without prior knowing the location of the usb.

    If anyone could help me out, would be greatly appreciated!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,659
    Well ANSI C knows nothing about COM ports or USB ports.

    For that, you need to tell us which OS and Compiler you're using.
    So the first thing you need to tell us is WHICH operating system and compiler you're using. Try to be specific, and not just say "windows and borland". There are many varieties of each.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Welcome to the forum, Striker.

    Your project unfortunately, sounds more like something for data theft, than a legit project.

    I'm not saying it is - I'm just saying it sounds like it is.

    I can't imagine someone would want a file printed to a usb drive, and not want to specify which usb port or drive, to copy the data to.

    Everything uses usb ports these days. It's not that uncommon to have two flash drives, or one flash drive, and one external back up usb drive, connected at the same time. And that would have your data go to the wrong drive, possibly.

    I'd nail down the drive you want to copy the data to. Just "a usb drive", is not specific enough to program for, imo.

  4. #4
    Registered User
    Join Date
    Aug 2010
    Posts
    3
    Windows XP, using the C/C++ compiler in windows studio 2008. First time using these types of forums so sorry for being abit vague

    Its for a college project, thats the specification,

    "matching utility program to run on a laptop PC to read the data from the local COM port and write it to a USB Flash Stick."

    And writing data to COM ports is fine, its just getting the mb file from array im not sure on how to do. The way ive done the project at the moment is to just send a normal text file.
    Last edited by Str1ker6; 08-10-2010 at 10:06 AM.

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,659
    So what is hard about
    char large[1024*1024]; // 1MB

    As for everything else, look at
    CreateFile Function (Windows)

    Most USB sticks will appear as a drive when you plug them in. So it's really just a matter of specifying a suitable filename to write to them
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Aug 2010
    Posts
    3
    Thanks for the link Salem, all the info i needed was in there. I was thinking it would be more complicated than that lol, over thinking again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to create and manipulate Terabyte size Arrays with Win32API
    By KrishnaPG in forum Windows Programming
    Replies: 1
    Last Post: 11-05-2009, 03:08 AM
  2. pointers & arrays and realloc!
    By zesty in forum C Programming
    Replies: 14
    Last Post: 01-19-2008, 03:24 PM
  3. Replies: 16
    Last Post: 01-01-2008, 03:07 PM
  4. Need Help With 3 Parallel Arrays Selction Sort
    By slickwilly440 in forum C++ Programming
    Replies: 4
    Last Post: 11-19-2005, 09:47 PM
  5. Crazy memory problem with arrays
    By fusikon in forum C++ Programming
    Replies: 9
    Last Post: 01-15-2003, 08:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21