Search Results

Search found 35302 results on 1413 pages for 'string literals'.

Page 72/1413 | < Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >

  • Given a string of letters from alphabet insert frequency of each character in the string.in O(n) time and O(1) space [on hold]

    - by learner
    Below is my attempt void str_freq(char *str, int len) { char c; int cnt=0; c=str[0]; int i,j=0; for(i=0;i<len;i++) { if(c==str[i]) { cnt++; } else { c = str[i]; // printf(" %d ",cnt); str[j] = str[i-1]; str[j+1] = (char)(((int)'0')+cnt); j++; cnt=0; } } str[j+1]='\0'; printf("%s",str); } int main() { char str[] = "aaabbccccdeffgggg"; int length=strlen(str); str_freq(str,length); } I am getting wrong answer abcdef1 instead of a3b2c4d1e1f2g4. Please let me know where I am going wrong.

    Read the article

  • Using a c# .net object in an Excel VBA form

    - by Mark O'G
    Hi I have a .net object that I want to use in Excel. I have an existing VBA script that i need to alter to call this the object from. I have then converted the object to a TLB. I've not really touched on this area before so any help will be appreciated. I have created an interface [Guid("0F700B48-E0CA-446b-B87E-555BCC317D74"),InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IOfficeCOMInterface { [DispId(1)] void ResetOrder(); [DispId(2)] void SetDeliveryAddress(string PostalName, string AddressLine1, string AddressLine2, string AddressLine3, string AddressLine4, string PostCode, string CountryCode, string TelephoneNo, string FaxNo, string EmailAddress); } I have also created an class that inherits that object. [ClassInterface(ClassInterfaceType.None), ProgId("NAMESPACE.OfficeCOMInterface"), Guid("9D9723F9-8CF1-4834-BE69-C3FEAAAAB530"), ComVisible(true)] public class OfficeCOMInterface : IOfficeCOMInterface, IDisposable { public void ResetSOPOrder() { } public void SetDeliveryAddress(string PostalName, string AddressLine1, string AddressLine2, string AddressLine3, string AddressLine4, string PostCode, string CountryCode, string TelephoneNo, string FaxNo, string EmailAddress) { try { SalesOrder.AmendDeliveryAddress(PostalName, AddressLine1, AddressLine2, AddressLine3, AddressLine4, PostCode); MessageBox.Show("Delivery address set"); } catch (Exception ex) { throw ex; } } }

    Read the article

  • Parser line break if string contains &#8211;

    - by pask
    Hi all, My NSXMLParser breaks on this string: <title>AAA &#8211; BCDEFGQWERTYUIO</title> I parsed it in this way, hope is the right way: - (void) parser: (NSXMLParser *) parser foundCharacters: (NSString *) string{ [...] if ([currentElement isEqualToString:@"title"]) { if (![string isEqualToString:@""]) { [title addObject:string]; NSLog(@"str: %@", string); } } it returns me: str: AAA str: - str: BCDEFGQWERTYUIO But i want to return a single string: str: AAA - BCDEFGQWERTYUIO because it's the correct title. Any idea? Thanks.

    Read the article

  • Convert byte array to understandable String

    - by Ender
    I have a program that handles byte arrays in Java, and now I would like to write this into a XML file. However, I am unsure as to how I can convert the following byte array into a sensible String to write to a file. Assuming that it was Unicode characters I attempted the following code: String temp = new String(encodedBytes, "UTF-8"); Only to have the debugger show that the encodedBytes contain "\ufffd\ufffd ^\ufffd\ufffd-m\ufffd\ufffd\/ufffd \ufffd\ufffdIA\ufffd\ufffd". The String should contain a hash in alphanumerical format. How would I turn the above String into a sensible String for output?

    Read the article

  • NetworkOnMainThread exception occuring

    - by Akshat
    I got a code from Android Hive to parse JSON data from url. Then I am trying to implement the same code on Rotten Tomatoes Upcoming Movies Api. I have implemented the same code with almost modifying all the xml files according to my needs. But the problem is when I am trying to run the code, its showing NetworkOnMainThread Exception. This is my code.. public class Upcoming extends ListActivity { String url = "http://api.rottentomatoes.com/api/public/v1.0/lists/movies/upcoming.json?apikey=yvvgsv722gy2zkey3ebkda5t"; final String TAG_MOVIES = "movies"; final String TAG_ID = "id"; final String TAG_TITLE = "title"; final String TAG_YEAR = "year"; final String TAG_MPAA_RATING = "mpaa_rating"; final String TAG_RUNTIME = "runtime"; final String TAG_RELEASE_DATES = "release_dates"; final String TAG_RATINGS = "ratings"; final String TAG_CRITIC_RATING = "critics_ratings"; final String TAG_AUDIENCE_RATING = "audience_ratings"; final String TAG_SYNOPSIS = "synopsis"; final String TAG_POSTERS = "posters"; JSONArray upcomings = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_upcoming_list); ArrayList<HashMap<String, String>> UpcomingList = new ArrayList<HashMap<String, String>>(); // Creating JSON Parser instance JSONParser jParser = new JSONParser(); // getting JSON string from URL JSONObject json = jParser.getJSONFromUrl(url); try { // Getting Array of Contacts upcomings = json.getJSONArray(TAG_MOVIES); // looping through All Contacts for(int i = 0; i < upcomings.length(); i++){ JSONObject c = upcomings.getJSONObject(i); // Storing each json item in variable String id = c.getString(TAG_ID); String title = c.getString(TAG_TITLE); String year = c.getString(TAG_YEAR); String mpaa_rating = c.getString(TAG_MPAA_RATING); String runtime = c.getString(TAG_RUNTIME); JSONObject release_dates = c.getJSONObject(TAG_RELEASE_DATES); JSONObject ratings = c.getJSONObject(TAG_RATINGS); String critic_rating = c.getString(TAG_CRITIC_RATING); String audience_rating = c.getString(TAG_AUDIENCE_RATING); String synopsis = c.getString(TAG_SYNOPSIS); JSONObject posters = c.getJSONObject(TAG_POSTERS); HashMap<String, String> map = new HashMap<String, String>(); map.put(TAG_TITLE, title); map.put(TAG_YEAR, year); map.put(TAG_CRITIC_RATING, critic_rating); map.put(TAG_AUDIENCE_RATING, audience_rating); UpcomingList.add(map); } } catch (JSONException e) { e.printStackTrace(); } ListAdapter adapter = new SimpleAdapter(this, UpcomingList, R.layout.activity_upcoming, new String[] { TAG_TITLE, TAG_YEAR, TAG_CRITIC_RATING, TAG_AUDIENCE_RATING }, new int[] { R.id.title, R.id.year, R.id.critic_rating, R.id.audience_rating }); setListAdapter(adapter); // selecting single ListView item ListView lv = getListView(); // Launching new screen on Selecting Single ListItem lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // getting values from selected ListItem String name = ((TextView) view.findViewById(R.id.title)).getText().toString(); String cost = ((TextView) view.findViewById(R.id.year)).getText().toString(); String critic_rating = ((TextView) view.findViewById(R.id.critic_rating)).getText().toString(); String audience_rating = ((TextView) view.findViewById(R.id.audience_rating)).getText().toString(); // Starting new intent Intent in = new Intent(getApplicationContext(), Upcoming.class); in.putExtra(TAG_TITLE, name); in.putExtra(TAG_YEAR, cost); in.putExtra(TAG_CRITIC_RATING, critic_rating); in.putExtra(TAG_AUDIENCE_RATING, audience_rating); startActivity(in); } }); } } Can anyone please help me with anything I am missing.? I am totally blind on it now. Thanx in advance.

    Read the article

  • NSFormatter problem: not getting called for the empty string

    - by Enchilada
    I have created a custom formatter for my (read-only) table column. It looks like this: - (NSString *)stringForObjectValue:(id)anObject { NSAssert([anObject isKindOfClass:[NSString class]] && anObject != nil, @"invalid object"); if ([anObject isEqualToString:@""]) return @"EMPTY"; else return [anObject stringByAppendingString:@"++"]; } Very simple. The corresponding objects are just strings, so it's an string-to-string formatter. All non-empty string objects are returned with @"++" appended to them. Empty string objects should be turned into the @"EMPTY" string. The @"++" gets appended to non-empty strings just fine. The problem is, @"EMPTY" never gets shown! My formatter is never called by Cocoa when the underlying object is the empty string. The corresponding row just keeps being empty, instead of showing my requested @"EMPTY". Any ideas?

    Read the article

  • Python: Elegant way to check if at least one regex in list matches a string

    - by houbysoft
    Hi. I have a list of regexes in python, and a string. Is there an elegant way to check if the at least one regex in the list matches the string? By elegant, I mean something better than simply looping through all of the regexes and checking them against the string and stopping if a match is found. Basically, I had this code: list = ['something','another','thing','hello'] string = 'hi' if string in list: pass # do something else: pass # do something else Now I would like to have some regular expressions in the list, rather than just strings, and I am wondering if there is an elegant solution to check for a match to replace if string in list:. Thanks in advance.

    Read the article

  • String or binary data would be truncated.

    - by Derek Dieter
    This error message is relatively straight forward. The way it normally happens is when you are trying to insert data from a table that contains values that have larger data lengths than the table you are trying to insert into. An example of this would be trying to insert data from a permanent table, into [...]

    Read the article

  • convert string data array to list

    - by prince23
    hi, i have an string data array which contains data like this 5~kiran 2~ram 1~arun 6~rohan now a method returns an value like string [] data public string [] names() { return data.Toarray() } public class Person { public string Name { get; set; } public int Age { get; set; } } List persons = new List(); string [] names =names(); now i need to copy all the data from an string array to an list and finally bind to grid view gridview.datasoutrce= persons how can i do it. is there any built in method to do it thanks in advance prince

    Read the article

  • Replace whitespaces using PHP preg_replace function ignoring quoted strings

    - by Saiful
    Look at the following string: SELECT column1 , column2, column3 FROM table1 WHERE column1 = 'text, "FROM" \'from\\\' x' AND column2 = "sample text 'where' \"where\\\" " AND ( column3 = 5 ) I need to escape unnecessary white space characters from the string like: removing white space from beginning and ending position of , ( ) etc removing newline (\r\n) and tabs (\t) But one thing. The remove process could not remove white spaces from the quoted string like: 'text, "FROM" \'from\\' x' "sample text 'where' \"where\\" " etc. i need to use the PHP function: preg_replace($pattern, $replacement, $string); So what will be the value of $pattern and $replacement where the value of $string is the given SQL.

    Read the article

  • Longest substring that appears n times

    - by xcoders
    For a string of length L, I want to find the longest substring that appears n (n<L) or more times in ths string. For example, the longest substring that occurs 2 or more times in "BANANA" is "ANA", once starting from index 1, and once again starting from index 3. The substrings are allowed to overlap. In the string "FFFFFF", the longest string that appears 3 or more times is "FFFF". The brute force algorithm for n=2 would be selecting all pairs of indexes in the string, then running along until the characters are different. The running-along part takes O(L) and the number of pairs is O(L^2) (duplicates are not allowed but I'm ignoring that) so the complexity of this algorithm for n=2 would be O(L^3). For greater values of n, this grows exponentially. Is there a more efficient algorithm for this problem?

    Read the article

  • doing a full permutation search and replace on a string

    - by user73307
    I'm writing an app that does something like a custom number (licence) place generator tool where if I ask for the plate "robin" it will suggest I try: r0bin rob1n r0b1n Are there any published algorithms which can do this? It has to be able to handle replacing single letters with multiples, e.g. m with rn and vise-versa and not fall over if it replaces an i with an l then comes to check the l and replaces it back to an i. The list of what gets swapped with what is going to be user input but I'm not expecting a huge list, possibly 10 pairs at most. I'll be implementing this in Ruby or Python but I should be able to convert code from any other language.

    Read the article

  • Is there any way to get the combine two xml into one xml in Linux.

    - by Tattat
    XML one is something like that: <dict> <key>2</key> <array> <string>A</string> <string>B</string> </array> <key>3</key> <array> <string>C</string> <string>D</string> <string>E</string> </array> </dict> XML Two is something like that: <dict> <key>A</key> <array> <string>A1</string> <false/> <false/> <array> <string>Apple</string> <string>This is an apple</string> </array> <array> <string>Apple Pie</string> <string>I love Apple Pie.</string> </array> </array> <key>B</key> <array> <string>B7</string> <false/> <false/> <array> <string>Boy</string> <string>I am a boy.</string> </array> </array> </dict> I want to convert to this: <dict> <key>2</key> <array> <string>A, Apple, Apple Pie</string> <string>B, Boy</string> </array> ... </dict>

    Read the article

  • Mod_Rewrite - Remove Query String From URLs

    There are plenty of tutorials and articles showing how to use the apache mod_rewrite module to tidy up messy URLs can create nice, human readable, search engine friendly URLs. No problem there and if that is what you are looking for you wont find that here.

    Read the article

  • How to generate a random unique string with more than 2^30 combination. I also wanted to reverse the process. Is this possible?

    - by Yusuf S
    I have a string which contains 3 elements: a 3 digit code (example: SIN, ABD, SMS, etc) a 1 digit code type (example: 1, 2, 3, etc) a 3 digit number (example: 500, 123, 345) Example string: SIN1500, ABD2123, SMS3345, etc.. I wanted to generate a UNIQUE 10 digit alphanumeric and case sensitive string (only 0-9/a-z/A-Z is allowed), with more than 2^30 (about 1 billion) unique combination per string supplied. The generated code must have a particular algorithm so that I can reverse the process. For example: public static void main(String[] args) { String test = "ABD2123"; String result = generateData(test); System.out.println(generateOutput(test)); //for example, the output of this is: 1jS8g4GDn0 System.out.println(generateOutput(result)); //the output of this will be ABD2123 (the original string supplied) } What I wanted to ask is is there any ideas/examples/libraries in java that can do this? Or at least any hint on what keyword should I put on Google? I tried googling using the keyword java checksum, rng, security, random number, etc and also tried looking at some random number solution (java SecureRandom, xorshift RNG, java.util.zip's checksum, etc) but I can't seem to find one? Thanks! EDIT: My use case for this program is to generate some kind of unique voucher number to be used by specific customers. The string supplied will contains 3 digit code for company ID, 1 digit code for voucher type, and a 3 digit number for the voucher nominal. I also tried adding 3 random alphanumeric (so the final digit is 7 + 3 digit = 10 digit). This is what I've done so far, but the result is not very good (only about 100 thousand combination): public static String in ="somerandomstrings"; public static String out="someotherrandomstrings"; public static String encrypt(String kata) throws Exception { String result=""; String ina=in; String outa=out; Random ran = new Random(); Integer modulus=in.length(); Integer offset= ((Integer.parseInt(Utils.convertDateToString(new Date(), "SS")))+ran.nextInt(60))/2%modulus; result=ina.substring(offset, offset+1); ina=ina+ina; ina=ina.substring(offset, offset+modulus); result=result+translate(kata, ina, outa); return result; } EDIT: I'm sorry I forgot to put the "translate" function : public static String translate(String kata,String seq1, String seq2){ String result=""; if(kata!=null&seq1!=null&seq2!=null){ String[] a=kata.split(""); for (int j = 1; j < a.length; j++) { String b=a[j]; String[]seq1split=seq1.split(""); String[]seq2split=seq2.split(""); int hint=seq1.indexOf(b)+1; String sq=""; if(seq1split.length>hint) sq=seq1split[hint]; String sq1=""; if(seq2split.length>hint) sq1=seq2split[hint]; b=b.replace(sq, sq1); result=result+b; } } return result; }

    Read the article

  • Need to create a string token dynamically base on which method is calling it

    - by sa
    This is a minimal code. I have the string Str which is used by various methods. I want to in getId method be able to do 2 things Assign class="PDP" to it and Give it a value3 So the final string looks like <tr class='PDP' id='{2}'> <td {0}</td><td>{1}</td></tr> But please note that I will need different values for class in different methods so some Str will have PDP, another will have PTM etc. Is there a clean way to achieve this . private const string Str = "<tr><td >{0}</td><td>{1}</td></tr>"; public static string getId() { string field=string.Format(str, value1,value2, found=true? value3:""); }

    Read the article

  • How to split a string with negative numbers using ActionScript 3.0

    - by inzombiak
    I'm having trouble loading my level. I'm using Ogmo to create my level then I import it. I have no problem converting 0's and 1's into an Array, but I can't figure out how to do the same for -1's. It separates the "-" and the "1". Any help would be great. I've posted my code and the XML files below levelXML = new XML(e.target.data); playerX = int(levelXML.Entities.Player.@x); playerY = int(levelXML.Entities.Player.@y); levelGrid = levelXML.Grid; levelGrid = levelGrid.split("\n").join(""); levelTiles = levelXML.Tiles; levelTiles = levelTiles.split("\n").join(""); levelTiles = levelTiles.split(",").join(""); tileArray = levelTiles.split(""); gridArray = levelGrid.split(""); for(i = 0; i <= 34; i++) { levelArray[i] = new Array(); for(j = 0; j <= 34; j++) { if(tileArray[j*35 + i] == 0) { gridArray[j*35+i] = -1; } var currentSymbol = gridArray[j*35+i]; levelArray[i][j] = currentSymbol; if(gridArray[j*35 + i] == 1) { wall = new Wall; addChild(wall); wall.x = i*20 + 10; wall.y = j*20 + 10; } else if(gridArray[j*35 + i] == -1) { pellet = new Pellet; addChild(pellet); pellet.x = i*20 + 10; pellet.y = j*20 + 10; } } } I know the code is very dirty, but I needed a quick fix. Grid exportMode="Bitstring" 11111111111111111111111111111111111 10000000000000000011000000000000001 10000000000000000011000000000000001 10011111001111110011001111110011001 10011111001111110011001111110011001 10011111001111110011001111110011001 10000000000000000000000000000000001 10000000000000000000000000000000001 10011111001100111111100110011111001 10011111001100000100000110011111001 10000000001100000100000110000000001 10000000001111100100111110000000001 11111111001111100100111110011111111 00000001001111100100111110010000000 00000001001100000000000110010000000 11111111001100000000000110011111111 00000000000000111111100000000000000 00000000000000100000100000000000000 11111111001100100000100110011111111 00000001001100111111100110010000000 00000001001100000000000110010000000 11111111001100111111100110011111111 10000000000000000100000000000000001 10000000000000000100000000000000001 10011111001111100100111110011111001 10000011000000000000000000011000001 10000011000000000000000000011000001 11110011001100111111100110011001111 11110011001100111111100110011001111 10000000001100000100000110000000001 10000000001100000100000110000000001 10011111111111100100111111111111001 10000000000000000000000000000000001 10000000000000000000000000000000001 11111111111111111111111111111111111 Tiles tileset="Tiles" exportMode="CSV"-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 -1,-1,-1,-1,-1,-1,-1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1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,-1 -1,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1

    Read the article

  • non-static method setPrzechowaj(java.lang.String) cannot be referenced froma a static context

    - by bigbluedragon
    hey i have problem with JDialogForm. I have created it using netbeans 6.8. That JDialogForm have textfield and button below it. and here is some code... private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String sciezka = jTextField1.getText(); if (sciezka.length() > 0) { Zmienne_pomocnicze.setPrzechowaj(sciezka); } } Now i want to copy that string "sciezka" to my main window but if I do it like this public class Zmienne_pomocnicze { public String n; public void setPrzechowaj (String neew) { n = neew; } public String getPrzechowaj () { return n; } } i get error in jButton1: non-static method setPrzechowaj(java.lang.String) cannot be referenced froma a static context any ideas?

    Read the article

  • Regular expression match, extracting only wanted segments of string

    - by Ben Carey
    I am trying to extract three segments from a string. As I am not particularly good with regular expressions, I think what I have done could probably be done better... I would like to extract the bold parts of the following string: SOMETEXT: ANYTHING_HERE (Old=ANYTHING_HERE, New=ANYTHING_HERE) Some examples could be: ABC: Some_Field (Old=,New=123) ABC: Some_Field (Old=ABCde,New=1234) ABC: Some_Field (Old=Hello World,New=Bye Bye World) So the above would return the following matches: $matches[0] = 'Some_Field'; $matches[1] = ''; $matches[2] = '123'; So far I have the following code: preg_match_all('/^([a-z]*\:(\s?)+)(.+)(\s?)+\(old=(.+)\,(\s?)+new=(.+)\)/i',$string,$matches); The issue with the above is that it returns a match for each separate segment of the string. I do not know how to ensure the string is the correct format using a regular expression without catching and storing the match if that makes sense? So, my question, if not already clear, how I can retrieve just the segments that I want from the above string?

    Read the article

  • How to remove a string from Dictionary<>

    - by Ranjana
    i have used dictionary to collect the array of values i have value in DataTable . How to compare the values get from DataTable, whether dictionary key contains the name in DataTable. if DataTable has not that value,then remove that key name from dictionary. My code: DataTable dtcolumnsname = clsServiceManager.Instnce.Get_ColumnNames(ClsUserInfo.UserName, strTableName); Dictionary<string,string> FinalDicColumnVal = new Dictionary<string,string>(); foreach (KeyValuePair<string, string> item in ColumnValues) { if (dtcolumnsname.Columns.Contains(item.Key)) { FinalDicColumnVal.Add(item.Key, item.Value); } } but this if (dtcolumnsname.Columns.Contains(item.Key)) is not get values of each datarow items in datatable.how to compare the dt row values with dictionary key names

    Read the article

  • Using Enums for comparing string values in Switch

    - by kaleidoscope
    Problem Scenario: There is an enum keeping track of operations to be performed on a table Public Enum PartitionKey { Createtask, Updatetask, Deletetask } User is entering the value for the operation to be performed and the code to check the value entered in switch case. Switch (value) {           case PartitionKey.Createtask.ToString():          {          Create();          break;          }          case PartitionKey.Updatetask.ToString():          {           Update();           break;          }          case PartitionKey.Deletetask.ToString():          {           Delete();          break;          } } and it displays as error as “.” Solution: One of the possible implmentation is as below. Public Enum PartitionKey: byte { Createtask, Updatetask, Deletetask } Switch ((PartitionKey)(Int32.Parse(value))) {          case PartitionKey.Createtask:          {                   Create();                   break;          }          case PartitionKey.Updatetask:          {                    Update();                   break;          }          case PartitionKey.Deletetask:          {                    Delete();                   break;          }          default:          {                   break;          } } Technorati Tags: Enum,A Constant Value is required,Geeta,C#

    Read the article

  • python dictionary conversion from string?

    - by shahjapan
    if I've string like "{ partner_name = test_partner}" OR " { partner_name : test_partner } its an example string will be very complex with several special characters included like =, [ , ] , { , } what will be the best way to convert it into a python object - so I can process it I tried with eval but it requires " ' " for string, but how can we add this special character \' before starting and ending of every word, I tried regular express re.findal('\w+') but it fails when my string contains ' _ ' or like characters as it will separate the string by ' _ ' Object of this question is my application needs, user friendly language as input - and I thought Json Dict will be good - but user is lazzy to put " ' " before and after of each string... then I thought for yaml but its also complex, if anybody can suggest better user friendly input which I use as python object - then please help me out.

    Read the article

  • How can I handle this string concatenation in C in a reusable way

    - by hyphen this
    I've been writing a small C application that operates on files, and I've found that I have been copy+pasting this code around my functions: char fullpath[PATH_MAX]; fullpath[0] = '\0'; strcat(fullpath, BASE_PATH); strcat(fullpath, subdir); strcat(fullpath, "/"); strcat(fullpath, filename); // do something with fullpath... Is there a better way? The first thought that comes to mind is to create a macro but I'm sure this is a common problem in C, and I'm wondering how others have solve it.

    Read the article

< Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >